nebulex v1.0.0-rc.2 Nebulex.Adapters.Local.Generation View Source
Generations Handler. This GenServer acts as garbage collector, everytime it runs, a new cache generation is created a the oldest one is deleted.
The only way to create new generations is through this module (this
server is the metadata owner) calling new/2
function. When a Cache
is created, a generations handler associated to that Cache is started
at the same time, therefore, this server MUST NOT be started directly.
See Nebulex.Adapters.Local.children/2
.
Options
:gc_interval
- Interval time in seconds to garbage collection to run, delete the oldest generation and create a new one. If this option is not set, garbage collection is never executed, so new generations must be created explicitly, e.g.:new(cache, [])
.
Link to this section Summary
Functions
Flushes the cache (including all its generations)
Creates a new cache generation. Once the max number of generations is reached, when a new generation is created, the oldest one is deleted
Link to this section Functions
new(Nebulex.Cache.t(), Nebulex.Cache.opts()) :: [atom()]
Creates a new cache generation. Once the max number of generations is reached, when a new generation is created, the oldest one is deleted
cache
- Cache Moduleopts
- List of options
Options
:reset_timeout
- Indicates if the poll frequency time-out should be reset or not (default: true).
Example
new_generation(MyCache, reset_timeout: :false)