TileStache.Goodies.Caches.LimitedDisk | index

`Cache that stores a limited amount of data.
This is an example cache that uses a SQLite database to track sizes and last-read
times for cached tiles, and removes least-recently-used tiles whenever the total
size of the cache exceeds a set limit.
Example TileStache cache configuration, with a 16MB limit:
"cache":
{
"class": "TileStache.Goodies.Caches.LimitedDisk.Cache",
"kwargs": {
"path": "/tmp/limited-cache",
"limit": 16777216
}
}`

Modules

``

os | sys | time |

Classes

``

Cache

class Cache

``

Methods defined here:

__init__(self, path, limit, umask=18)

lock(self, layer, coord, format)
  `Acquire a cache lock for this tile.
  Returns nothing, but (TODO) blocks until the lock has been acquired.
  Lock is implemented as a row in the "locks" table.`

read(self, layer, coord, format)
  `Read a cached tile.
  If found, update the used column in the tiles table with current time.`

remove(self, layer, coord, format)
  `Remove a cached tile.`

save(self, body, layer, coord, format)

unlock(self, layer, coord, format)
  `Release a cache lock for this tile.
  Lock is implemented as a row in the "locks" table.`

Functions

``

connect(...)
  `connect(database[, timeout, isolation_level, detect_types, factory])
  Opens a connection to the SQLite database file *database*. You can use
  ":memory:" to open a database connection to a database that resides in
  RAM instead of on disk.`