@absolunet/ioc2.1.0

View on GitHub

RuntimeDriver

Cache driver that uses a runtime variable to cache data. Since it only uses a variable, the cached values are flushed hen the process closes.

Extends

Members

config :object.<string, *>

Source:
Inherited From:
Current driver configuration data.

engine :*

Source:
Inherited From:
Current engine accessor.

Methods

get(key, defaultValueopt)

Source:
Overrides:
Retrieve an item from the cache by key.
Parameters:
Name Type Attributes Description
key string The cache key.
defaultValue * <optional>
The default value.
Returns:
The cached value.
Type
Promise.<*>

(async) put(key, value, secondsopt)

Source:
Overrides:
Insert an item in the cache with key and expiration delay.
Parameters:
Name Type Attributes Description
key string The cache key.
value * The value to cache.
seconds number <optional>
The cache expiration delay, in seconds.
Returns:
The async process promise.
Type
Promise

(async) forever(key, value)

Source:
Overrides:
Insert an item in the cache with key forever, without expiration.
Parameters:
Name Type Description
key string The cache key.
value * The value to cache.
Returns:
The async process promise.
Type
Promise

(async) increment(key, incrementopt)

Source:
Overrides:
Increment an item in cache.
Parameters:
Name Type Attributes Default Description
key string The cache key.
increment number <optional>
1 The increment value to add to the cached entry.
Returns:
The async process promise.
Type
Promise

(async) decrement(key, decrementopt)

Source:
Overrides:
Decrement an item in cache.
Parameters:
Name Type Attributes Default Description
key string The cache key.
decrement number <optional>
1 The decrement value to substract from the cached entry.
Returns:
The async process promise.
Type
Promise

(async) delete(key)

Source:
Overrides:
Delete an item in the cache by key.
Parameters:
Name Type Description
key string The cache key.
Returns:
The async process promise.
Type
Promise

(async) flush()

Source:
Overrides:
Delete all items the cache.
Returns:
The async process promise.
Type
Promise

now()

Source:
Inherited From:
Get current time in seconds.
Returns:
The current unix timestamp.
Type
number

setEngine(engine)

Source:
Inherited From:
Set current engine.
Parameters:
Name Type Description
engine * The engine instance.
Returns:
The current instance.
Type
support.mixins.HasEngine