nebulex v1.0.0-rc.2 Nebulex.Adapter behaviour View Source
This module specifies the adapter API that a Cache adapter is required to implement.
Link to this section Summary
Callbacks
The callback invoked in case the adapter needs to inject code
Returns the children specs that starts the adapter process
Deletes a single object from Cache
Flushes the cache
Retrieves a single object from Cache
Gets the value from key
and updates it, all in one pass
Returns whether the given key
exists in Cache
Returns all cached keys
Returns and removes a single object from Cache if key
exists,
otherwise returns nil
Invokes reducer
for each entry in the cache, passing the key, the return
and the accumulator acc
as arguments. reducer
’s return value is stored
in acc
Stores a single object in the Cache
Returns the cache size (total number of cached entries)
Returns a map with all cache entries
Updates the cached key
with the given function
Updates (increment or decrement) the counter mapped to the given key
Link to this section Types
Link to this section Callbacks
__before_compile__({line :: Macro.Env.line(), env :: Macro.Env.t()}, env :: Macro.Env.t()) :: Macro.t()
The callback invoked in case the adapter needs to inject code.
children(cache(), opts()) :: [Supervisor.Spec.spec()]
Returns the children specs that starts the adapter process.
Deletes a single object from Cache.
See Nebulex.Cache.delete/2
.
Flushes the cache.
See Nebulex.Cache.flush/0
.
Retrieves a single object from Cache.
See Nebulex.Cache.get/2
.
Gets the value from key
and updates it, all in one pass.
See Nebulex.Cache.get_and_update/3
.
Returns whether the given key
exists in Cache.
See Nebulex.Cache.has_key/2
.
Returns all cached keys.
See Nebulex.Cache.keys/0
.
Returns and removes a single object from Cache if key
exists,
otherwise returns nil
.
See Nebulex.Cache.pop/2
.
Invokes reducer
for each entry in the cache, passing the key, the return
and the accumulator acc
as arguments. reducer
’s return value is stored
in acc
.
Returns the accumulator.
See Nebulex.Cache.reduce/2
.
Stores a single object in the Cache.
See Nebulex.Cache.set/3
.
Returns the cache size (total number of cached entries).
See Nebulex.Cache.size/0
.
Returns a map with all cache entries.
See Nebulex.Cache.to_map/1
.
Updates the cached key
with the given function.
See Nebulex.Cache.update/4
.
Updates (increment or decrement) the counter mapped to the given key
.
See Nebulex.Cache.update_counter/3
.