TileStache.Redis module¶
Caches tiles to Redis
- Requires redis-py and redis-server
https://pypi.python.org/pypi/redis/ http://redis.io/
sudo apt-get install redis-server pip install redis
Example configuration:
- “cache”: {
- “name”: “Redis”, “host”: “localhost”, “port”: 6379, “db”: 0, “key prefix”: “unique-id”
}
Redis cache parameters:
- host
- Defaults to “localhost” if omitted.
- port
- Integer; Defaults to 6379 if omitted.
- db
- Integer; Redis database number, defaults to 0 if omitted.
- key prefix
- Optional string to prepend to generated key. Useful when running multiple instances of TileStache that share the same Redis database to avoid key collisions (though the prefered solution is to use a different db number). The key prefix will be prepended to the key name. Defaults to “”.
-
class
TileStache.Redis.Cache(host='localhost', port=6379, db=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.Redis.tile_key(layer, coord, format, key_prefix)¶ Return a tile key string.