Module jc_eviction_manager

jc_eviction_manager 1: Implements item-level ttl by spying on the cache table, creating and deleting TTL timers as indicated by the ttl attribute of the cache entry.

Copyright © (C) 2011-2015, Jim Rosenblum

Behaviours: gen_server.

Authors: Jim Rosenblum.

Description

jc_eviction_manager 1: Implements item-level ttl by spying on the cache table, creating and deleting TTL timers as indicated by the ttl attribute of the cache entry. A unique reference is assocateid with a cached item, and a TTL timer has this unique reference as part of its sate. When the timer goes off, it evicts using this cache-item reference. This ensures that the timer never evicts anything but the correct'version' of an item. If an item is updated (a 'Put' with a Map and Key of an existing value), it will get a new referenceso the old TTL will not evict the updated version even if it goes off before it can be cancelled. 2: Implements a map-based ttl (max_ttl) by using a timer to periodically evict any cache items whose create time is older than the configured value for a given map.

Data Types

map_name()

map_name() = any()

seconds()

seconds() = non_neg_integer()

Function Index

get_max_ttls/0Return [{Map, TTLSecs}].
set_max_ttl/2Create, change or delete the max TTL associated with a map.
start_link/0Starts the server and links the caller to it.

Function Details

get_max_ttls/0

get_max_ttls() -> [{Map::map_name(), Secs::seconds()}]

Return [{Map, TTLSecs}].

set_max_ttl/2

set_max_ttl(Map::map_name(), Secs::seconds()) -> ok | {error, badarg}

Create, change or delete the max TTL associated with a map. 0 seconds will remove the max_ttl for the map alltogether. Existing values are overwritten.

start_link/0

start_link() -> {ok, pid()} | ignore | {error, any()}

Starts the server and links the caller to it.


Generated by EDoc, May 24 2016, 22:38:41.