An in-memory LRU cache for Node.js implemented in C++11 using std::unordered_map and std::list, offering high performance for large caches. Version 1.2.6 supports Node 14/16 on OSX and Linux. It is an alternative to node-lru-cache for very large hashes, avoiding V8 object overhead. Last updated in 2021, it is in maintenance mode with no recent releases.
npm install lru-native2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows instantiation with options, set/get, size, remove, clear, and stats.
Migrate to 'lru-cache' (npm package) or 'quick-lru'.
Ensure build-essential tools are installed (e.g., 'apt install build-essential' on Ubuntu).
Always use strings for keys. Coerce keys with String(key) if needed.
Explicitly set maxElements to a positive integer for bounded cache.
Run 'npm install -g node-gyp' and ensure build tools are installed (e.g., 'apt install build-essential' or 'xcode-select --install' on macOS).
Use node-gyp v8.x and Python 3.6+; see node-gyp documentation.
Recompile the module: run 'npm rebuild lru-native2' or 'node-gyp rebuild'.