TileStache.Memcache module¶
Caches tiles to Memcache.
- Requires python-memcached:
- http://pypi.python.org/pypi/python-memcached
Example configuration:
- “cache”: {
- “name”: “Memcache”, “servers”: [“127.0.0.1:11211”], “revision”: 0, “key prefix”: “unique-id”
}
Memcache cache parameters:
- servers
- Optional array of servers, list of “{host}:{port}” pairs. Defaults to [“127.0.0.1:11211”] if omitted.
- revision
- Optional revision number for mass-expiry of cached tiles regardless of lifespan. Defaults to 0.
- key prefix
- Optional string to prepend to Memcache generated key. Useful when running multiple instances of TileStache that share the same Memcache instance to avoid key collisions. The key prefix will be prepended to the key name. Defaults to “”.
-
class
TileStache.Memcache.Cache(servers=['127.0.0.1:11211'], revision=0, key_prefix='')¶ -
lock(layer, coord, format)¶ Acquire a cache lock for this tile.
Returns nothing, but blocks until the lock has been acquired.
-
read(layer, coord, format)¶ Read a cached tile.
-
remove(layer, coord, format)¶ Remove a cached tile.
-
save(body, layer, coord, format)¶ Save a cached tile.
-
unlock(layer, coord, format)¶ Release a cache lock for this tile.
-
-
TileStache.Memcache.tile_key(layer, coord, format, rev, key_prefix)¶ Return a tile key string.