There is currently no cache cleaning in gnome, and large caches slow down login noticeably (bug 430123).I don't think having this in a library is the right thing. It should rather be handled by some desktop process that periodically does this for users, such that no app is forced to do this themselves. For instance, gnome-settings-daemon could periodically spawn a child to do this.
OK, thanks, I'll check that out. - Mike