{"library":"simple-lru-cache","title":"Simple LRU Cache","description":"The `simple-lru-cache` package offers a minimalistic and fast Least Recently Used (LRU) cache implementation for Node.js. Its core functionality revolves around prioritizing recently accessed keys, ejecting the least recently used key only when the cache reaches its configured maximum size (`maxSize`). Despite its explicit goal of simplicity and speed, the package is currently at version 0.0.2 and has not seen updates for over eight years, indicating it is abandoned. This makes it unsuitable for modern production environments due to potential security vulnerabilities, lack of compatibility with newer Node.js versions, and absence of modern features like time-based expiration (TTL). Its key differentiator was intended to be its extreme simplicity and speed compared to more feature-rich alternatives like `lru-cache`, but its current state makes it a significant risk. Developers should consider maintained alternatives or native JavaScript `Map` objects for simple caching needs.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install simple-lru-cache"],"cli":null},"imports":["var SimpleCache = require(\"simple-lru-cache\")"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"var SimpleCache = require(\"simple-lru-cache\");\n\n// Initialize the cache with a maximum size of 1000 items\nvar cache = new SimpleCache({\"maxSize\":1000});\n\n// Add a key-value pair to the cache\ncache.set(\"hello\",\"world\");\n\n// Retrieve a value by its key\nvar value = cache.get(\"hello\");\nconsole.log(`Retrieved: ${value}`); // Output: Retrieved: world\n\n// Add more items to trigger LRU eviction if maxSize is reached\nfor (let i = 0; i < 1001; i++) {\n  cache.set(`key${i}`, `value${i}`);\n}\n\n// Delete a specific key from the cache\ncache.del(\"hello\");\nconsole.log(`'hello' after deletion: ${cache.get('hello')}`); // Output: 'hello' after deletion: undefined\n\n// Reset the entire cache, removing all entries\ncache.reset();\nconsole.log(`Cache size after reset: ${cache.size()}`); // Output: Cache size after reset: 0","lang":"javascript","description":"Demonstrates basic cache initialization and common operations including setting, getting, deleting, and resetting entries.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}