Constructor
new Store(plugin)
Constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
plugin | Bajo. |
- Source
Members
app :Bajo.App
Reference to the app instance.
Type:
- Bajo.
App
- Source
buildOpts
Utility function to build options for storage operations.
- Source
plugin :Bajo.Plugin
Reference to the plugin instance.
Type:
- Bajo.
Plugin
- Source
storage :Dobo.Model
Reference to the storage model.
Type:
- Dobo.
Model
- Source
Methods
(async) clear() → {Promise.<boolean>}
Clear all cached items.
- Source
Returns:
- Returns true if the cache was successfully cleared
- Type:
- Promise.<boolean>
(async) clearExpired() → {Promise.<boolean>}
Clear all expired cached items.
- Source
Returns:
- Returns true if the expired cache items were successfully cleared
- Type:
- Promise.<boolean>
(async) delete(key) → {Promise.<boolean>}
Delete the cached item for the given key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the cached item |
- Source
Returns:
- Returns true if the item was successfully deleted
- Type:
- Promise.<boolean>
(async) deleteMany(keys) → {Promise.<boolean>}
Delete multiple cached items for the given keys.
Parameters:
| Name | Type | Description |
|---|---|---|
keys | Array.<string> | The keys of the cached items |
- Source
Returns:
- Returns true if the items were successfully deleted
- Type:
- Promise.<boolean>
(async) get(key) → {Promise.<any>}
Get the cached item for the given key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the cached item |
- Source
Returns:
- Returns the cached item or undefined if expired/not found
- Type:
- Promise.<any>
(async) getMany(keys) → {Promise.<Array.<any>>}
Get multiple cached items for the given keys.
Parameters:
| Name | Type | Description |
|---|---|---|
keys | Array.<string> | The keys of the cached items |
- Source
Returns:
- Returns an array of cached items or undefined for expired/not found items
- Type:
- Promise.<Array.<any>>
(async) has(key) → {Promise.<boolean>}
Check if a cached item exists for the given key.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the cached item |
- Source
Returns:
- Returns true if the item exists and is not expired
- Type:
- Promise.<boolean>
(async) set(key, value, ttl) → {Promise.<boolean>}
Set a cached item for the given key with an optional TTL.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key of the cached item |
value | any | The value to cache |
ttl | number | Time to live in milliseconds |
- Source
Returns:
- Returns true if the item was successfully cached
- Type:
- Promise.<boolean>