StaticMaps.TileCache.ETS (staticmaps v0.1.0)

Copy Markdown View Source

The default tile cache: an ETS table in memory, lost on restart.

The cache holds at most :max_bytes of tile bodies, 64 MB by default. When a put takes it over the limit, the least recently used tiles are evicted until it is back under 90% of the limit, so eviction does not run again on every put.

config :staticmaps, :tile_cache, max_bytes: 128 * 1024 * 1024

Summary

Functions

The total size of the tile bodies held, in bytes.

Returns a specification to start this module under a supervisor.

Like get/1, for the cache started as name.

Like put/2, for the cache started as name.

Starts the cache.

Functions

bytes(name \\ __MODULE__)

The total size of the tile bodies held, in bytes.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(name, key)

Like get/1, for the cache started as name.

put(name, key, entry)

Like put/2, for the cache started as name.

start_link(opts \\ [])

Starts the cache.

Options: :name (default StaticMaps.TileCache.ETS) and :max_bytes.