Skip to content

Commit 8e85031

Browse files
committed
build: update dist files
1 parent ab6843b commit 8e85031

7 files changed

Lines changed: 19 additions & 37 deletions

File tree

dist/tiny-lru.cjs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ class LRU {
332332
* @memberof LRU
333333
* @param {string} key - The key to set.
334334
* @param {*} value - The value to store.
335-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
336335
* @returns {Object|null} The evicted item (if any) with shape {key, value, expiry, prev, next}, or null.
337336
* @example
338337
* const cache = new LRU(2);
@@ -342,13 +341,13 @@ class LRU {
342341
* @see {@link LRU#evict}
343342
* @since 11.3.0
344343
*/
345-
setWithEvicted(key, value, resetTtl = this.resetTtl) {
344+
setWithEvicted(key, value) {
346345
let evicted = null;
347346
let item = this.items[key];
348347

349348
if (item !== undefined) {
350349
item.value = value;
351-
if (resetTtl) {
350+
if (this.resetTtl) {
352351
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
353352
}
354353
this.moveToEnd(item);
@@ -389,8 +388,6 @@ class LRU {
389388
* @memberof LRU
390389
* @param {string} key - The key to set.
391390
* @param {*} value - The value to store.
392-
* @param {boolean} [bypass=false] - Internal parameter for setWithEvicted method.
393-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
394391
* @returns {LRU} The LRU instance for method chaining.
395392
* @example
396393
* cache.set('key1', 'value1')
@@ -400,21 +397,18 @@ class LRU {
400397
* @see {@link LRU#setWithEvicted}
401398
* @since 1.0.0
402399
*/
403-
set(key, value, bypass = false, resetTtl = this.resetTtl) {
400+
set(key, value) {
404401
let item = this.items[key];
405402

406-
if (bypass || item !== undefined) {
407-
// Existing item: update value and position
403+
if (item !== undefined) {
408404
item.value = value;
409405

410-
if (bypass === false && resetTtl) {
406+
if (this.resetTtl) {
411407
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
412408
}
413409

414-
// Always move to end, but the bypass parameter affects TTL reset behavior
415410
this.moveToEnd(item);
416411
} else {
417-
// New item: check for eviction and create
418412
if (this.max > 0 && this.size === this.max) {
419413
this.evict(true);
420414
}

dist/tiny-lru.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ class LRU {
330330
* @memberof LRU
331331
* @param {string} key - The key to set.
332332
* @param {*} value - The value to store.
333-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
334333
* @returns {Object|null} The evicted item (if any) with shape {key, value, expiry, prev, next}, or null.
335334
* @example
336335
* const cache = new LRU(2);
@@ -340,13 +339,13 @@ class LRU {
340339
* @see {@link LRU#evict}
341340
* @since 11.3.0
342341
*/
343-
setWithEvicted(key, value, resetTtl = this.resetTtl) {
342+
setWithEvicted(key, value) {
344343
let evicted = null;
345344
let item = this.items[key];
346345

347346
if (item !== undefined) {
348347
item.value = value;
349-
if (resetTtl) {
348+
if (this.resetTtl) {
350349
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
351350
}
352351
this.moveToEnd(item);
@@ -387,8 +386,6 @@ class LRU {
387386
* @memberof LRU
388387
* @param {string} key - The key to set.
389388
* @param {*} value - The value to store.
390-
* @param {boolean} [bypass=false] - Internal parameter for setWithEvicted method.
391-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
392389
* @returns {LRU} The LRU instance for method chaining.
393390
* @example
394391
* cache.set('key1', 'value1')
@@ -398,21 +395,18 @@ class LRU {
398395
* @see {@link LRU#setWithEvicted}
399396
* @since 1.0.0
400397
*/
401-
set(key, value, bypass = false, resetTtl = this.resetTtl) {
398+
set(key, value) {
402399
let item = this.items[key];
403400

404-
if (bypass || item !== undefined) {
405-
// Existing item: update value and position
401+
if (item !== undefined) {
406402
item.value = value;
407403

408-
if (bypass === false && resetTtl) {
404+
if (this.resetTtl) {
409405
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
410406
}
411407

412-
// Always move to end, but the bypass parameter affects TTL reset behavior
413408
this.moveToEnd(item);
414409
} else {
415-
// New item: check for eviction and create
416410
if (this.max > 0 && this.size === this.max) {
417411
this.evict(true);
418412
}

dist/tiny-lru.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tiny-lru.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tiny-lru.umd.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ class LRU {
330330
* @memberof LRU
331331
* @param {string} key - The key to set.
332332
* @param {*} value - The value to store.
333-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
334333
* @returns {Object|null} The evicted item (if any) with shape {key, value, expiry, prev, next}, or null.
335334
* @example
336335
* const cache = new LRU(2);
@@ -340,13 +339,13 @@ class LRU {
340339
* @see {@link LRU#evict}
341340
* @since 11.3.0
342341
*/
343-
setWithEvicted(key, value, resetTtl = this.resetTtl) {
342+
setWithEvicted(key, value) {
344343
let evicted = null;
345344
let item = this.items[key];
346345

347346
if (item !== undefined) {
348347
item.value = value;
349-
if (resetTtl) {
348+
if (this.resetTtl) {
350349
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
351350
}
352351
this.moveToEnd(item);
@@ -387,8 +386,6 @@ class LRU {
387386
* @memberof LRU
388387
* @param {string} key - The key to set.
389388
* @param {*} value - The value to store.
390-
* @param {boolean} [bypass=false] - Internal parameter for setWithEvicted method.
391-
* @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
392389
* @returns {LRU} The LRU instance for method chaining.
393390
* @example
394391
* cache.set('key1', 'value1')
@@ -398,21 +395,18 @@ class LRU {
398395
* @see {@link LRU#setWithEvicted}
399396
* @since 1.0.0
400397
*/
401-
set(key, value, bypass = false, resetTtl = this.resetTtl) {
398+
set(key, value) {
402399
let item = this.items[key];
403400

404-
if (bypass || item !== undefined) {
405-
// Existing item: update value and position
401+
if (item !== undefined) {
406402
item.value = value;
407403

408-
if (bypass === false && resetTtl) {
404+
if (this.resetTtl) {
409405
item.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl;
410406
}
411407

412-
// Always move to end, but the bypass parameter affects TTL reset behavior
413408
this.moveToEnd(item);
414409
} else {
415-
// New item: check for eviction and create
416410
if (this.max > 0 && this.size === this.max) {
417411
this.evict(true);
418412
}

dist/tiny-lru.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tiny-lru.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)