← Back to team overview

ubuntu-phone team mailing list archive

Re: Unity API status update

 

On 16/06/14 15:29, Olivier Tilloy wrote:

Do I understand it correctly that it’s a generic and transparent image cache? If so, please consider including it in the UITK, to benefit all applications that load images/icons from the network.

The cache implementation is independent of the network. It's just a simple class that provides a persistent map of <string,blob> pairs. It maintains the cache in LRU order and, once the cache is full, automatically trims the cache down to make room for the newest entry. It also supports optional explicit expiry times and dynamic resizing.

It's not particularly fast because it uses sqlite under the covers. That's because we need guaranteed recovery if something goes wrong, such as a partial write if the battery dying at the wrong moment (which could potentially brick the phone). But the cache is still plenty fast enough compared to waiting for an HTTP request to complete for each image.

The cache is currently MR'd here:

https://code.launchpad.net/~michihenning/unity-api/PersistentCache

The plan is to have the shell hook the cache up with the network. (I wanted a stand-alone cache class so it can be used in other contexts.)

Michi.


References