Store

Cache store class

Constructor

new Store(plugin)

Constructor.

Parameters:
NameTypeDescription
pluginBajo.Plugin

Members

app :Bajo.App

Reference to the app instance.

Type:
  • Bajo.App

buildOpts

Utility function to build options for storage operations.

plugin :Bajo.Plugin

Reference to the plugin instance.

Type:
  • Bajo.Plugin

storage :Dobo.Model

Reference to the storage model.

Type:
  • Dobo.Model

Methods

(async) clear() → {Promise.<boolean>}

Clear all cached items.

Returns:
  • Returns true if the cache was successfully cleared
Type: 
Promise.<boolean>

(async) clearExpired() → {Promise.<boolean>}

Clear all expired cached items.

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:
NameTypeDescription
keystring

The key of the cached item

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:
NameTypeDescription
keysArray.<string>

The keys of the cached items

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:
NameTypeDescription
keystring

The key of the cached item

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:
NameTypeDescription
keysArray.<string>

The keys of the cached items

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:
NameTypeDescription
keystring

The key of the cached item

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:
NameTypeDescription
keystring

The key of the cached item

valueany

The value to cache

ttlnumber

Time to live in milliseconds

Returns:
  • Returns true if the item was successfully cached
Type: 
Promise.<boolean>