@@ -25,14 +25,14 @@ class LRU {
2525 * @constructor
2626 * @param {number } [max=0] - Maximum number of items to store. 0 means unlimited.
2727 * @param {number } [ttl=0] - Time to live in milliseconds. 0 means no expiration.
28- * @param {boolean } [resetTtl =false] - Whether to reset TTL when updating existing items via set().
28+ * @param {boolean } [resetTTL =false] - Whether to reset TTL when updating existing items via set().
2929 */
30- constructor ( max = 0 , ttl = 0 , resetTtl = false ) {
30+ constructor ( max = 0 , ttl = 0 , resetTTL = false ) {
3131 this . first = null ;
3232 this . items = Object . create ( null ) ;
3333 this . last = null ;
3434 this . max = max ;
35- this . resetTtl = resetTtl ;
35+ this . resetTTL = resetTTL ;
3636 this . size = 0 ;
3737 this . ttl = ttl ;
3838 this . #stats = { hits : 0 , misses : 0 , sets : 0 , deletes : 0 , evictions : 0 } ;
@@ -297,7 +297,7 @@ class LRU {
297297
298298 if ( item !== undefined ) {
299299 item . value = value ;
300- if ( this . resetTtl ) {
300+ if ( this . resetTTL ) {
301301 item . expiry = this . ttl > 0 ? Date . now ( ) + this . ttl : this . ttl ;
302302 }
303303 this . moveToEnd ( item ) ;
@@ -345,7 +345,7 @@ class LRU {
345345 if ( item !== undefined ) {
346346 item . value = value ;
347347
348- if ( this . resetTtl ) {
348+ if ( this . resetTTL ) {
349349 item . expiry = this . ttl > 0 ? Date . now ( ) + this . ttl : this . ttl ;
350350 }
351351
@@ -661,11 +661,11 @@ class LRU {
661661 * @function lru
662662 * @param {number } [max=1000] - Maximum number of items to store. Must be >= 0. Use 0 for unlimited size.
663663 * @param {number } [ttl=0] - Time to live in milliseconds. Must be >= 0. Use 0 for no expiration.
664- * @param {boolean } [resetTtl =false] - Whether to reset TTL when updating existing items via set().
664+ * @param {boolean } [resetTTL =false] - Whether to reset TTL when updating existing items via set().
665665 * @returns {LRU } A new LRU cache instance.
666666 * @throws {TypeError } When parameters are invalid (negative numbers or wrong types).
667667 */
668- function lru ( max = 1000 , ttl = 0 , resetTtl = false ) {
668+ function lru ( max = 1000 , ttl = 0 , resetTTL = false ) {
669669 if ( isNaN ( max ) || max < 0 ) {
670670 throw new TypeError ( "Invalid max value" ) ;
671671 }
@@ -674,11 +674,11 @@ function lru(max = 1000, ttl = 0, resetTtl = false) {
674674 throw new TypeError ( "Invalid ttl value" ) ;
675675 }
676676
677- if ( typeof resetTtl !== "boolean" ) {
678- throw new TypeError ( "Invalid resetTtl value" ) ;
677+ if ( typeof resetTTL !== "boolean" ) {
678+ throw new TypeError ( "Invalid resetTTL value" ) ;
679679 }
680680
681- return new LRU ( max , ttl , resetTtl ) ;
681+ return new LRU ( max , ttl , resetTTL ) ;
682682}
683683
684684exports . LRU = LRU ;
0 commit comments