The cache module

Cache logic.

class ImageEntry(image)[source]

Bases: object

class ImageCache[source]

Bases: object

Cache generated images.

Store and retrieve them under a key (see render.Renderer.key()).

maxsize = 209715200
currentsize = 0
clear()[source]

Remove all cached images.

invalidate(page)[source]

Clear cache contents for the specified page.

tileset(key)[source]

Return a dictionary with tile-entry pairs for the key.

If no single tile is available, an empty dict is returned.

addtile(key, tile, image)[source]

Add image for the specified key and tile.

closest(key)[source]

Iterate over suitable image tilesets but with a different size.

Yields (width, height, tileset) tuples.

This can be used for interim display while the real image is being rendered.