Directus / @directus/memory / index / KvRedis
Class: KvRedis
Implements
Constructors
new KvRedis(config)
new KvRedis(
config
):KvRedis
Parameters
• config: Omit
<KvConfigRedis
, "type"
>
Returns
Source
packages/memory/src/kv/lib/redis.ts:37
Properties
compression
private
compression:boolean
Source
packages/memory/src/kv/lib/redis.ts:34
compressionMinSize
private
compressionMinSize:number
Source
packages/memory/src/kv/lib/redis.ts:35
namespace
private
namespace:string
Source
packages/memory/src/kv/lib/redis.ts:33
redis
private
redis:ExtendedRedis
Source
packages/memory/src/kv/lib/redis.ts:32
Methods
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
Source
packages/memory/src/kv/lib/redis.ts:81
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
Source
packages/memory/src/kv/lib/redis.ts:51
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
Source
packages/memory/src/kv/lib/redis.ts:85
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
Source
packages/memory/src/kv/lib/redis.ts:90
set()
set<
T
>(key
,value
):Promise
<void
>
Save the given value to the store
Type parameters
• T = unknown
Parameters
• key: string
Key to save in the store
• value: T
Value to save to the store. Can be any JavaScript primitive, plain object, or array
Returns
Promise
<void
>
Implementation of
Source
packages/memory/src/kv/lib/redis.ts:67
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