new Storage(conf) → {Object}
Sets the storage configuration
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object |
- Source:
Returns:
- Type
- Object
Methods
-
<inner> all() → {Array}
-
Function to get all stored items
- Source:
Returns:
All stored items with value and key- Type
- Array
-
<inner> clear()
-
Function that clears the storage
- Source:
-
<inner> find(key) → {*|undefined}
-
Function that tries to find a key and returns the stored value
Parameters:
Name Type Description key
string identifier for value - Source:
Returns:
result of value lookup- Type
- * | undefined
-
<inner> free(amount)
-
Frees a specified amount of values from the storage. It removes the oldest stored values.
Parameters:
Name Type Argument Default Description amount
number <optional>
1 number of values that needs to be freed - Source:
-
<inner> on(topic, callback) → {*}
-
Function to register an listener for a specific topic
Parameters:
Name Type Description topic
string callback
function Function that is called once the emitter emits a message under the topic - Source:
Returns:
emitter.on result- Type
- *
-
<inner> remove(key)
-
Removes a value using a key
Parameters:
Name Type Description key
string identifier for value - Source:
-
<inner> size() → {number}
-
Function that returns the storage size
- Source:
Returns:
storage size- Type
- number
-
<inner> store(key, value, expires)
-
Function that stores a value using a key
Parameters:
Name Type Argument Description key
string identifier for value value
* value that needs to be stored expires
number <optional>
- Source: