Comparing version 1.0.0 to 1.1.0
@@ -7,9 +7,1 @@ export declare class LruMap<K, V> extends Map<K, V> { | ||
} | ||
export declare class LruTtlMap<K, V> extends LruMap<K, V> { | ||
private readonly expiry; | ||
clear(): void; | ||
delete(key: K): boolean; | ||
has(key: K, now?: number): boolean; | ||
get(key: K, now?: number): V | undefined; | ||
set(key: K, value: V, expiry?: number): this; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LruTtlMap = exports.LruMap = void 0; | ||
exports.LruMap = void 0; | ||
class LruMap extends Map { | ||
@@ -25,37 +25,1 @@ constructor(limit = Infinity) { | ||
exports.LruMap = LruMap; | ||
class LruTtlMap extends LruMap { | ||
constructor() { | ||
super(...arguments); | ||
this.expiry = new Map(); | ||
} | ||
clear() { | ||
this.expiry.clear(); | ||
super.clear(); | ||
} | ||
delete(key) { | ||
this.expiry.delete(key); | ||
return super.delete(key); | ||
} | ||
has(key, now = 0) { | ||
if (!super.has(key)) | ||
return false; | ||
const expiry = this.expiry.get(key) || 0; | ||
const expired = now > expiry; | ||
if (expired) | ||
this.delete(key); | ||
return !expired; | ||
} | ||
get(key, now) { | ||
if (!this.has(key, now)) | ||
return undefined; | ||
const value = super.get(key); | ||
super.set(key, value); | ||
return value; | ||
} | ||
set(key, value, expiry = Infinity) { | ||
super.set(key, value); | ||
this.expiry.set(key, expiry); | ||
return this; | ||
} | ||
} | ||
exports.LruTtlMap = LruTtlMap; |
@@ -7,9 +7,1 @@ export declare class LruMap<K, V> extends Map<K, V> { | ||
} | ||
export declare class LruTtlMap<K, V> extends LruMap<K, V> { | ||
private readonly expiry; | ||
clear(): void; | ||
delete(key: K): boolean; | ||
has(key: K, now?: number): boolean; | ||
get(key: K, now?: number): V | undefined; | ||
set(key: K, value: V, expiry?: number): this; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LruTtlMap = exports.LruMap = void 0; | ||
exports.LruMap = void 0; | ||
class LruMap extends Map { | ||
@@ -25,37 +25,1 @@ constructor(limit = Infinity) { | ||
exports.LruMap = LruMap; | ||
class LruTtlMap extends LruMap { | ||
constructor() { | ||
super(...arguments); | ||
this.expiry = new Map(); | ||
} | ||
clear() { | ||
this.expiry.clear(); | ||
super.clear(); | ||
} | ||
delete(key) { | ||
this.expiry.delete(key); | ||
return super.delete(key); | ||
} | ||
has(key, now = 0) { | ||
if (!super.has(key)) | ||
return false; | ||
const expiry = this.expiry.get(key) || 0; | ||
const expired = now > expiry; | ||
if (expired) | ||
this.delete(key); | ||
return !expired; | ||
} | ||
get(key, now) { | ||
if (!this.has(key, now)) | ||
return undefined; | ||
const value = super.get(key); | ||
super.set(key, value); | ||
return value; | ||
} | ||
set(key, value, expiry = Infinity) { | ||
super.set(key, value); | ||
this.expiry.set(key, expiry); | ||
return this; | ||
} | ||
} | ||
exports.LruTtlMap = LruTtlMap; |
@@ -7,9 +7,1 @@ export declare class LruMap<K, V> extends Map<K, V> { | ||
} | ||
export declare class LruTtlMap<K, V> extends LruMap<K, V> { | ||
private readonly expiry; | ||
clear(): void; | ||
delete(key: K): boolean; | ||
has(key: K, now?: number): boolean; | ||
get(key: K, now?: number): V | undefined; | ||
set(key: K, value: V, expiry?: number): this; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LruTtlMap = exports.LruMap = void 0; | ||
exports.LruMap = void 0; | ||
class LruMap extends Map { | ||
@@ -25,37 +25,1 @@ constructor(limit = Infinity) { | ||
exports.LruMap = LruMap; | ||
class LruTtlMap extends LruMap { | ||
constructor() { | ||
super(...arguments); | ||
this.expiry = new Map(); | ||
} | ||
clear() { | ||
this.expiry.clear(); | ||
super.clear(); | ||
} | ||
delete(key) { | ||
this.expiry.delete(key); | ||
return super.delete(key); | ||
} | ||
has(key, now = 0) { | ||
if (!super.has(key)) | ||
return false; | ||
const expiry = this.expiry.get(key) || 0; | ||
const expired = now > expiry; | ||
if (expired) | ||
this.delete(key); | ||
return !expired; | ||
} | ||
get(key, now) { | ||
if (!this.has(key, now)) | ||
return undefined; | ||
const value = super.get(key); | ||
super.set(key, value); | ||
return value; | ||
} | ||
set(key, value, expiry = Infinity) { | ||
super.set(key, value); | ||
this.expiry.set(key, expiry); | ||
return this; | ||
} | ||
} | ||
exports.LruTtlMap = LruTtlMap; |
{ | ||
"name": "thingies", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": { |
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
37250
69
1152