{"id":46618,"library":"throwaway-local-cache","title":"throwaway-local-cache","description":"A lightweight Node.js library for maintaining a fast local disk-backed cache without strict persistence guarantees. Version 1.3.0 is the latest stable release. It stores data on the filesystem, queuing writes and deletions to be batched and flushed asynchronously. Unlike persistent databases, it prioritizes speed over durability, making it ideal for temporary or disposable caches. It has minimal dependencies and a simple synchronous-like API using async/await.","status":"active","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/holepunchto/throwaway-local-cache","tags":["javascript"],"install":[{"cmd":"npm install throwaway-local-cache","lang":"bash","label":"npm"},{"cmd":"yarn add throwaway-local-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add throwaway-local-cache","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS only; ESM imports will fail.","wrong":"import Cache from 'throwaway-local-cache'","symbol":"Cache","correct":"const Cache = require('throwaway-local-cache')"},{"note":"If using ESM, the default import works but requires the package to be loaded via createRequire or a bundler.","wrong":"","symbol":"Cache","correct":"import Cache from 'throwaway-local-cache'"},{"note":"The default export is the Cache constructor, but destructuring also works.","wrong":"const cache = require('throwaway-local-cache')","symbol":"Cache","correct":"const { Cache } = require('throwaway-local-cache')"}],"quickstart":{"code":"const Cache = require('throwaway-local-cache');\nconst path = require('path');\n\nasync function main() {\n  const c = new Cache(path.join(__dirname, 'cache'));\n  await c.put('key', { value: true });\n  console.log(await c.get('key')); // { value: true }\n  await c.del('key');\n  await c.flush();\n}\nmain().catch(console.error);","lang":"javascript","description":"Creates a cache instance in a local folder, puts an entry, retrieves it, deletes it, and flushes all changes to disk."},"warnings":[{"fix":"Call await cache.flush() before exiting to ensure data is written.","message":"Data may be lost on crash: queued puts/deletes are not immediately persisted.","severity":"gotcha","affected_versions":"*"},{"fix":"Implement your own cleanup logic or use a library like lru-cache if automatic eviction is needed.","message":"The cache does not support TTL or automatic eviction; manual deletion required.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'1.3.0':23 'api':71 'async/await':73 'asynchron':44 'back':16 'batch':41 'cach':4,17,60 'data':31 'databas':47 'delet':38 'depend':64 'disk':15 'disk-back':14 'dispos':59 'durabl':52 'fast':12 'filesystem':34 'flush':43 'guarante':21 'ideal':55 'javascript':74 'latest':26 'librari':8 'lightweight':6 'like':70 'local':3,13 'maintain':10 'make':53 'minim':63 'node.js':7 'persist':20,46 'priorit':49 'queu':35 'releas':28 'simpl':67 'speed':50 'stabl':27 'store':30 'strict':19 'synchron':69 'synchronous-lik':68 'temporari':57 'throwaway':2 'throwaway-local-cach':1 'unlik':45 'use':72 'version':22 'without':18 'write':36","created_at":"2026-06-07T13:00:47.957418+00:00","updated_at":"2026-06-07T13:00:47.957418+00:00","problems":[{"fix":"Run 'npm install throwaway-local-cache' in your project directory.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'throwaway-local-cache'"},{"fix":"Use require() instead of import, or use a bundler that handles CommonJS.","cause":"Using ESM import but the package is CommonJS.","error":"TypeError: Cache is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/holepunchto/throwaway-local-cache","github":"https://github.com/holepunchto/throwaway-local-cache","docs":null,"changelog":null,"pypi":null,"npm":"throwaway-local-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}