Skip to content

Commit 6cf9e21

Browse files
committed
documentation
1 parent ebd9b04 commit 6cf9e21

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cache/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ class CacheNode {
3030
* - Passive expiration upon access
3131
* - Statistics tracking (hits, misses, evictions)
3232
* - Pattern-based invalidation for cache clearing
33+
* Default: 1000 entries, 1GB, 5 minutes TTL
3334
*/
3435
class LRUCache {
35-
constructor(maxLength = 1000, maxBytes = 1000000000, ttl = 300000) { // Default: 1000 entries, 1000 MB, 5 minutes TTL
36+
constructor(maxLength = 1000, maxBytes = 1000000000, ttl = 300000) {
3637
this.maxLength = maxLength
3738
this.maxBytes = maxBytes
3839
this.life = Date.now()
@@ -333,7 +334,7 @@ class LRUCache {
333334
return this.objectContainsProperties(obj, query.body)
334335
}
335336

336-
// For direct queries (like {"type":"Cachetest"}), check if object matches
337+
// For direct queries (like {"type":"CacheTest"}), check if object matches
337338
return this.objectContainsProperties(obj, query)
338339
}
339340

@@ -444,7 +445,7 @@ class LRUCache {
444445
// Create singleton cache instance
445446
// Configuration can be adjusted via environment variables
446447
const CACHE_MAX_LENGTH = parseInt(process.env.CACHE_MAX_LENGTH ?? 1000)
447-
const CACHE_MAX_BYTES = parseInt(process.env.CACHE_MAX_BYTES ?? 1000000000) // 1000 MB
448+
const CACHE_MAX_BYTES = parseInt(process.env.CACHE_MAX_BYTES ?? 1000000000) // 1GB
448449
const CACHE_TTL = parseInt(process.env.CACHE_TTL ?? 300000) // 5 minutes default
449450
const cache = new LRUCache(CACHE_MAX_LENGTH, CACHE_MAX_BYTES, CACHE_TTL)
450451

0 commit comments

Comments
 (0)