Closed etscrivner closed 9 years ago
is there a way to timestaamp a tile in the redis cache?
i guess i was asking if this can be done? https://github.com/OSGeo/tilecache/blob/master/tilecache/TileCache/Caches/Disk.py#L49
@winkey Not 100% sure I understand, but if you mean is there a way to expire tiles in the redis cache then absolutely. We currently use the SETEX command to create a new key/value with a time-to-live (TTL) in seconds. Redis then takes care of deleting the key once it has expired. We could also use the TTL method to determine the remaining number of seconds a key has before expiration. If you'd like to store additional information, like a timestamp, along with the tile then we could use a hashmap object and manually expire it.
well the idea is if each tile is timestamped, you can set a expire time on the layer in the config. then when the cache is acessed it checks if the tile is older that the timestamp in the config, if so it deletes the tile and requests a new one from the source. so whenever your data changes you just change the expire time in the config and the cache rebuilds itself on the fly
@winkey So that can absolutely be done by simply using a hash instead of a mere key/value store. This backend is merely meant to serve as a basic replacement for the memcached backend, but it could absolutely leverage the additional features in Redis to do more.
would that be something that you would be willing to add? all the work outside of the cache module is already done and quite well tested
I'll see what I can do, looks quite straightforward to add.
On Wed, Dec 3, 2014 at 3:26 PM, Brian Case notifications@github.com wrote:
would that be something that you would be willing to add? all the work outside of the cache module is already done and quite well tested
— Reply to this email directly or view it on GitHub https://github.com/OSGeo/tilecache/pull/9#issuecomment-65511275.
Add redis cache backend.
Explanation
The organization I work for (ParkMe) are in the process of phasing out memcached in favor or redis. This pull request adds a redis cache backend to facilitate this transition.