@@ -174,7 +174,7 @@ console.log(removed); // 2 (number of items removed)
174174
175175** Returns:** ` number ` - Number of expired items removed
176176
177- ** Note:** Only removes items when TTL is enabled (` ttl > 0 ` ).
177+ ** Note:** Only removes items when TTL is enabled (` ttl > 0 ` ). Does not support method chaining (returns ` number ` ).
178178
179179---
180180
@@ -232,7 +232,7 @@ console.log(cache.entries(["c", "a"]));
232232| ------ | ---------- | ---------------------------------- |
233233| ` keys ` | ` string[] ` | Optional specific keys to retrieve |
234234
235- ** Returns:** ` Array<[ string, * ]> ` - Array of key-value pairs
235+ ** Returns:** ` Array<( string|*)[ ]> ` - Array of key-value pairs
236236
237237---
238238
@@ -292,7 +292,7 @@ cache.forEach((value, key, cache) => {
292292| Name | Type | Description |
293293| --------- | ---------- | --------------------------------------- |
294294| ` callback ` | ` function ` | Function to call for each item. Signature: ` callback(value, key, cache) ` |
295- | ` thisArg ` | ` Object ` | Value to use as ` this ` when executing callback |
295+ | ` thisArg ` | ` * ` | Value to use as ` this ` when executing callback |
296296
297297** Returns:** ` LRU ` - this instance (for chaining)
298298
@@ -458,6 +458,8 @@ cache.set("a", 1).set("b", 2).set("c", 3).set("d", 4);
458458
459459** Returns:** ` LRU ` - this instance (for chaining)
460460
461+ ** Throws:** ` TypeError ` if callback is not a function
462+
461463** Note:** Only the last registered callback will be used. Triggers on:
462464- Explicit eviction via ` evict() `
463465- Implicit eviction via ` set() ` /` setWithEvicted() ` when cache is at max capacity
@@ -529,6 +531,8 @@ console.log(cache.keys()); // ['b', 'c']
529531
530532** Returns:** ` { key, value, expiry } | null ` - Evicted item (if any) or ` null ` when no eviction occurs
531533
534+ ** Note:** When updating an existing key with ` resetTtl=true ` , the TTL is reset but no eviction occurs (returns ` null ` ).
535+
532536---
533537
534538### ` sizeByTTL() `
@@ -609,7 +613,7 @@ console.log(cache.values());
609613// [1, 2, 3]
610614
611615console .log (cache .values ([" c" , " a" ]));
612- // [3, 1] - respects LRU order
616+ // [3, 1] - order matches input array
613617```
614618
615619** Parameters:**
@@ -655,7 +659,7 @@ When `setWithEvicted` returns an evicted item:
655659
656660## Method Chaining
657661
658- All mutation methods return ` this ` for chaining:
662+ All mutation methods return ` this ` for chaining (except ` cleanup() ` which returns ` number ` ) :
659663
660664``` javascript
661665cache .set (" a" , 1 ).set (" b" , 2 ).set (" c" , 3 ).delete (" a" ).evict ();
0 commit comments