Comparing version 5.3.0 to 5.3.1
@@ -90,2 +90,7 @@ type EventListener = (...arguments_: any[]) => void; | ||
set(key: string, value: any, ttl?: number): any; | ||
setMany?(values: Array<{ | ||
key: string; | ||
value: any; | ||
ttl?: number; | ||
}>): Promise<void>; | ||
delete(key: string): Promise<boolean>; | ||
@@ -98,3 +103,2 @@ clear(): Promise<void>; | ||
deleteMany?(key: string[]): Promise<boolean>; | ||
setMany?(data: KeyvEntry[]): Promise<boolean[]>; | ||
iterator?<Value>(namespace?: string): AsyncGenerator<Array<string | Awaited<Value> | undefined>, void>; | ||
@@ -269,3 +273,2 @@ } & IEventEmitter; | ||
*/ | ||
set<Value = GenericValue>(key: KeyvEntry[]): Promise<boolean[]>; | ||
set<Value = GenericValue>(key: string, value: Value, ttl?: number): Promise<boolean>; | ||
@@ -272,0 +275,0 @@ /** |
@@ -537,6 +537,10 @@ // src/index.ts | ||
} | ||
/** | ||
* Set an item to the store | ||
* @param {string | Array<KeyvEntry>} key the key to use. If you pass in an array of KeyvEntry it will set many items | ||
* @param {Value} value the value of the key | ||
* @param {number} [ttl] time to live in milliseconds | ||
* @returns {boolean} if it sets then it will return a true. On failure will return false. | ||
*/ | ||
async set(key, value, ttl) { | ||
if (Array.isArray(key)) { | ||
return this.setMany(key); | ||
} | ||
this.hooks.trigger("preSet" /* PRE_SET */, { key, value, ttl }); | ||
@@ -543,0 +547,0 @@ const keyPrefixed = this._getKeyPrefix(key); |
{ | ||
"name": "keyv", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Simple key-value storage with support for multiple backends", | ||
@@ -67,9 +67,9 @@ "type": "module", | ||
"xo": "^0.60.0", | ||
"@keyv/compress-gzip": "^2.0.2", | ||
"@keyv/compress-brotli": "^2.0.3", | ||
"@keyv/compress-gzip": "^2.0.2", | ||
"@keyv/mongo": "^3.0.1", | ||
"@keyv/compress-lz4": "^1.0.0", | ||
"@keyv/test-suite": "^2.0.5", | ||
"@keyv/memcache": "^2.0.1", | ||
"@keyv/compress-lz4": "^1.0.0", | ||
"@keyv/mongo": "^3.0.1", | ||
"@keyv/sqlite": "^4.0.1", | ||
"@keyv/test-suite": "^2.0.5" | ||
"@keyv/sqlite": "^4.0.1" | ||
}, | ||
@@ -76,0 +76,0 @@ "tsd": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
91367
1827