Skip to content
On this page

Directus Cloud

Everything you need to start building. Provisioned in 90 seconds. Starting at $15/month.

Get Started

This is an auto-generated document to support extension builders understand the internal packages they can utilize. To find our written guides, tutorials, and API/SDK reference, check out our main docs .

Directus / @directus/memory / index / KvLocal

Class: KvLocal ​

Implements ​

Constructors ​

new KvLocal() ​

new KvLocal(config): KvLocal

Parameters ​

• config: Omit<KvConfigLocal, "type">

Returns ​

KvLocal

Defined in ​

packages/memory/src/kv/lib/local.ts:9

Methods ​

clear() ​

clear(): Promise<void>

Remove all keys from the kv store

Returns ​

Promise<void>

Implementation of ​

Kv.clear

Defined in ​

packages/memory/src/kv/lib/local.ts:72


delete() ​

delete(key): Promise<void>

Remove the given key from the store

Parameters ​

• key: string

Key to remove from the store

Returns ​

Promise<void>

Implementation of ​

Kv.delete

Defined in ​

packages/memory/src/kv/lib/local.ts:34


get() ​

get<T>(key): Promise<undefined | T>

Get the stored value by key. Returns undefined if the key doesn't exist in the store

Type Parameters ​

• T = unknown

Parameters ​

• key: string

Key to retrieve from the store

Returns ​

Promise<undefined | T>

Stored value, or undefined if key doesn't exist

Implementation of ​

Kv.get

Defined in ​

packages/memory/src/kv/lib/local.ts:19


has() ​

has(key): Promise<boolean>

Check if a given key exists in the store

Parameters ​

• key: string

Key to check

Returns ​

Promise<boolean>

Implementation of ​

Kv.has

Defined in ​

packages/memory/src/kv/lib/local.ts:38


increment() ​

increment(key, amount): Promise<number>

Increment the given stored value by the given amount

Parameters ​

• key: string

Key to increment in the store

• amount: number = 1

Amount to increment. Defaults to 1

Returns ​

Promise<number>

Updated value

Implementation of ​

Kv.increment

Defined in ​

packages/memory/src/kv/lib/local.ts:42


set() ​

set(key, value): Promise<void>

Save the given value to the store

Parameters ​

• key: string

Key to save in the store

• value: unknown

Value to save to the store. Can be any JavaScript primitive, plain object, or array

Returns ​

Promise<void>

Implementation of ​

Kv.set

Defined in ​

packages/memory/src/kv/lib/local.ts:29


setMax() ​

setMax(key, value): Promise<boolean>

Save the given value to the store if the given value is larger than the existing value

Parameters ​

• key: string

Key to save in the store

• value: number

Number to save to the store if it's bigger than the current value

Returns ​

Promise<boolean>

Whether or not the given value was saved

Implementation of ​

Kv.setMax

Defined in ​

packages/memory/src/kv/lib/local.ts:56