0

I am building an application that can be used to load many large pictures. Once the pictures are loaded into the interface, it provides thumbnails of the larger images. The user can then interact with the images in various ways.

Now, these thumbnails are cached into ~/.cache/programname/. This way, if the user attempts to reload the same pictures, the thumbnails are automatically picked and thus no resizing takes place. The large pictures take some time to be resized to thumbnail size, so I guess this is a legit technique.

I have limited the cache size to 12MB (around 5000 image thumbnails) but this adds complications:

  • If user exceeds the 12MB limit, then my program will do something that he doesn't expect (aka starting mass deletion of files). User is not informed of the operation in any way.
  • The deletion is done in that row: Delete thumbnails of pictures that do not belong in the current, selected by the user, folder (stop deleting pictures if sometime in-between cacheSize < 12MB), and if cacheSize is still >12MB delete some pictures that are in the selected folder till cacheSize < 12MB
  • In order for me to be able to prioritize the deletion (aka see if a picture is in the current folder), I have to save the original picture filename, along with the md5sum of it into the thumbnail filename. BUT, / char is not allowed into filenames, so I used the ^ character instead. What if the filename/path of the original image already includes the ^ character? Implement a system inside the thumbnail's filename that specifies the ^ characters that should not be replaced.

All these complications, for a simple file, generate a filename such as:

47b29c689cc43f43de3ea3c7c68e4e3c=^usr^share^backgrounds^gnome^Road.jpg

When the file already contains the ^ character, the index(es) of the characters are saved in the filename:

47b29c689cc43f43de3ea3c7c68e4e3c=21.^home^alex^Pictures^1^1.png

My original thought when implementing this was to not eat up user space and it works just fine on doing that.

Now I am thinking about adding a 'Clear Cache' button in the Preferences dialog of my program and not care about space during the caching process. That would be simpler to implement, as saving just the md5sum of the image would be more than enough.

These are the options I have thought:

  1. Do not care about space. Use just the md5sum. 'Clear Cache' button.
  2. Current implementation: Care about space. User does not care about cache space as long as it doesn't eat up his whole hard drive, so have a set max value (12MB) and clear the cache selectively when cache exceeds that size.
  3. Care about space. User also cares about the amount of cache. Provide a slider and let user adjust how much space he wants to provide for the caching.

I think that solution 3 is not user-friendly, because the average user does not need to know what cache is. But, using the same logic, the average user does not know what the 'Clear Cache' button is; he just wants the program to load fast - and that's what cache does.

That's why I chose solution 2, but it has the disadvantage of doing actions without user consent.

What are your opinions on the issue?

2

Because the term of cache itself is rather technical for average user, it seems, that by default the user should avoid meeeting it in your primary interface scenarios. But for more experienced users adding both "clear cache" button and adding slider to set up max cache space value can be a good decision.

Similar solutions you can see in such mass-products, as browsers — for instance, there is option to clear history in Google Chrome (this button is in History), and option to manage cookies etc for more experienced users (but all this stuff is hidden in advanced settings).

Also you can improve the communication about cache and it's function itself -- instead of "clear cache" button use "clear thumbnails", and instead of option "Use image caching" use option (checkbox or anything else) "Load images faster with previews" and additional explanation that it will require extra space on user's HDD. So users, that not familiar with cache concept, could better select the necessary option -- to use fast images but with extra space, or load slower but with more care to space.

And finally, you can also try to check available disk space on program start/finish and decide, weither to use caching (and less or more disk space), or to turn it off and clear it in extra thread, i.e. in manner, invisible to user.

  • So, essentially, what you're saying is to have an 'Advanced' section in my Preferences where these issues are addressed, and go with solution 3 – hytromo Nov 27 '14 at 11:17
  • @hakermania yes, and it is really important to use more fittable statements and phraseology (less technical) to users – Alex Ovtcharenko Nov 27 '14 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.