Class: CacheStoreShared<IsAsync, Value, C>
Defined in: schemas/v2/cache/shared.ts:33
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
IsAsync extends boolean | - |
Value | - |
C extends Record<string, unknown> | { key: string; } |
Constructors
Constructor
new CacheStoreShared<
IsAsync,Value,C>(async,binding?,options?):CacheStoreShared<IsAsync,Value,C>
Defined in: schemas/v2/cache/shared.ts:54
Parameters
| Parameter | Type |
|---|---|
async | IsAsync |
binding? | CacheStoreBinding<IsAsync, Value> |
options? | CacheStoreSharedOptions<C> |
Returns
CacheStoreShared<IsAsync, Value, C>
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
binding | public | CacheStoreBinding<IsAsync, Value> | The binding used for persistent storage of cache values. Defaults to storing the values in the process memory. |
options | public | Required<CacheStoreSharedOptions<C>> | Options for the cache. Can be used to control how the cache behaves on edits or other options for custom cache items. |
Methods
bulkDelete()
bulkDelete(
keys):IfAsync<IsAsync,void>
Defined in: schemas/v2/cache/shared.ts:203
Deletes the values for multiple items. If the binding has not configured a bulkDelete handler, the delete handler will be used for all items.
Parameters
| Parameter | Type | Description |
|---|---|---|
keys | C[] | List of identifiers. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, void>
bulkGet()
bulkGet(
keys):IfAsync<IsAsync, ({key:string;value:Value; } |undefined)[]>
Defined in: schemas/v2/cache/shared.ts:177
Gets the values for multiple items. If the binding has not configured a bulkGet handler, the get handler will be used for all items.
Parameters
| Parameter | Type | Description |
|---|---|---|
keys | C[] | List of identifiers. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, ({ key: string; value: Value; } | undefined)[]>
bulkPut()
bulkPut(
items):IfAsync<IsAsync,void>
Defined in: schemas/v2/cache/shared.ts:152
Sets the values for multiple items. If the binding has not configured a bulkPut handler, the put handler will be used for all items.
Parameters
| Parameter | Type | Description |
|---|---|---|
items | (C & { value: Value; })[] | List of identifiers with the values. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, void>
delete()
delete(...
args):IfAsync<IsAsync,void>
Defined in: schemas/v2/cache/shared.ts:95
Delete a value.
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | ObjValueTuple<C> | The identifier of the value. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, void>
deleteAll()
deleteAll():
IfAsync<IsAsync,void>
Defined in: schemas/v2/cache/shared.ts:84
Deletes all values if the binding has defined a deleteAll handler.
Returns
IfAsync<IsAsync, void>
edit()
edit(...
args):If<IsAsync,Promise<Value|undefined>,Value|undefined>
Defined in: schemas/v2/cache/shared.ts:128
Edits a value. Uses the options.patchUnknownItem to control how unknown values are edited.
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | [...ObjValueTuple<C, TuplifyUnion<keyof C, LastOf<keyof C>, [keyof C] extends [never] ? true : false>, []>[], value: Partial<Value> | ((item) => Value)] | The identifier of the value with the new (partial) item. Use the converter options for handling custom values. |
Returns
If<IsAsync, Promise<Value | undefined>, Value | undefined>
get()
get(...
args):IfAsync<IsAsync,Value|undefined>
Defined in: schemas/v2/cache/shared.ts:118
Gets a value.
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | ObjValueTuple<C> | The identifier of the value. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, Value | undefined>
isAsync()
isAsync():
boolean
Defined in: schemas/v2/cache/shared.ts:76
Returns
boolean
whether this cache is using an async binding.
put()
put(...
args):IfAsync<IsAsync,void>
Defined in: schemas/v2/cache/shared.ts:105
Sets a value.
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | [...ObjValueTuple<C>[], value: Value] | The identifier with the value. Use the converter options for handling custom values. |
Returns
IfAsync<IsAsync, void>
createAsync()
staticcreateAsync<Value,Store>(store,binding?,options?):InstanceType<Store>
Defined in: schemas/v2/cache/shared.ts:226
Type Parameters
| Type Parameter |
|---|
Value |
Store extends typeof CacheStoreShared |
Parameters
| Parameter | Type |
|---|---|
store | Store |
binding? | CacheStoreBinding<true, Value> |
options? | Partial<Store["prototype"]["options"]> |
Returns
InstanceType<Store>
createSync()
staticcreateSync<Value,Store>(store,binding?,options?):InstanceType<Store>
Defined in: schemas/v2/cache/shared.ts:218
Type Parameters
| Type Parameter |
|---|
Value |
Store extends typeof CacheStoreShared |
Parameters
| Parameter | Type |
|---|---|
store | Store |
binding? | CacheStoreBinding<false, Value> |
options? | Partial<Store["prototype"]["options"]> |
Returns
InstanceType<Store>