how to use the cache-to-disk feature in Wallpaper

Aaron J. Seigo aseigo at kde.org
Sun Apr 12 17:56:39 CEST 2009


On Sunday 12 April 2009, Benoit Jacob wrote:
> (*******************)
> Plasma::Wallpaper should remember for each cached image it's
> "context": that is (i guess), which containment it belongs to. That
> could be either stored in the filename, or by storing in different
> sub-directories.

if you have 3 containments with the same image as the wallpaper, it shouldn't 
create three cache files on disk. so there is no real mapping from cache file 
to containment; there is a mapping of sorts between wallpaper plugins and the 
cache file they are using ... 

> Periodically, Plasma should then erase all but the most recent image
> for each containment, or at least offer an API to let the wallpaper do
> so ("erase all my images except for this list of keys that should be
> kept").

perhaps what we could do is keep track of the files in the wallpaper cache 
along with the last stored-or-retrieved cache file in Wallpaper .. then when 
the cache grows above a certain amount (disk space? number of files in 
relation to # of wallpaper plugins performing caching?) it could prune off the 
oldest files that aren't in use (as defined by "last stored-or-retrieved cache 
files from all currently active wallpapers) until it is under the limit.

one speedbump to this might be that wallpapers don't get configured until they 
are about to paint (for obvious performance reasons: we don't want to load 10 
backgrounds at startup when you can only see one of your containments! nor do 
we want to keep all that in memory either if you aren't going to be viewing 
those other containments any time soon.) 

that means that we may not know which cache files are "actually" in use and 
end up deleting cache files that will be recreated soon.

we could do some bookkeeping on disk for the caching usage, which would allow 
this data to exist even when the Wallpaper plugins haven't be initialized, but 
that might be over-engineering things for no real world gains that matter.

> That also suggests that plasma should remember also which
> wallpaper plugin an image belongs to -- currently i put "mandelbrot"
> in the key but Plasma could do it for me.

this would make sharing cached images between plugins impossible which is why 
i didn't do this in Wallpaper :)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090412/561e2a27/attachment.sig 


More information about the Plasma-devel mailing list