brave-cache
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -72,4 +72,5 @@ import BraveCacheProvider from "./src/provider"; | ||
* @param set The value to set | ||
* @param ttl The time to live in seconds | ||
*/ | ||
getOrSet<Value = any>(key: string, set: Value | (() => Value)): Value; | ||
getOrSet<Value = any>(key: string, set: Value | (() => Value), ttl?: number): Value; | ||
/** | ||
@@ -76,0 +77,0 @@ * Async: Find or create a value in the cache |
@@ -162,8 +162,9 @@ "use strict"; | ||
* @param set The value to set | ||
* @param ttl The time to live in seconds | ||
*/ | ||
getOrSet(key, set) { | ||
getOrSet(key, set, ttl) { | ||
if (this.has(key)) | ||
return this.get(key); | ||
const value = (0, functions_1.bc_getDefaultValue)(set); | ||
this.set(key, value); | ||
this.set(key, value, ttl); | ||
return value; | ||
@@ -170,0 +171,0 @@ } |
{ | ||
"name": "brave-cache", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A flexible semantic Api for handling multiple node cache drivers.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38030
857