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

Benoit Jacob jacob.benoit.1 at gmail.com
Sun Apr 12 17:15:08 CEST 2009


2009/4/10 Aaron J. Seigo <aseigo at kde.org>:
> papers (maybe i should add that bookkeeping into Wallpaper itself? Hmmmm..
> yes, probably... "let me get back to you on that one," he says, again.)

ok: caching is now implemented in Mandelbrot (r952792).

Here's again a somewhat lengthy email but you can skip to (***********).

I think i now have a clearer idea of what part of the bookkeeping
needs to be done in Plasma::Wallpaper and what can be done in
Mandelbrot.

The bookkeeping that Mandelbrot itself does is "whenever you insert a
new image into the cache, remove the previous image".

With this simple bookkeeping, stale cached images are inevitable when:
1) plasma crashes after caching the image and before saving the viewpoint.
2) the user is bored of mandelbrot and chooses another wallpaper
instead: then the cached images stay.

There is also a 3rd circumstance but for that one i've got an ugly workaround:
3) When we open Desktop Settings, the mini monitor may show a
different viewpoint than the previous time (if the user moved the view
in between). So the previous cached image stays.

The ugly workaround for 3) was to only cache images that have > 100000 pixels...

Anyway, here's a proposal:

(*******************)
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.

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"). 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.

Cheers,
Benoit


More information about the Plasma-devel mailing list