{"_id":"@anymux/cache","name":"@anymux/cache","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@anymux/cache","version":"0.1.0","type":"module","license":"MIT","description":"Caching layer for AnyMux file systems","keywords":["anymux","filesystem","cache","performance"],"repository":{"type":"git","url":"git+https://github.com/AnyMux/AnyMuxMonorepo.git","directory":"packages/cache"},"homepage":"https://github.com/AnyMux/AnyMuxMonorepo/tree/main/packages/cache#readme","engines":{"node":">=20"},"main":"./src/index.ts","types":"./src/index.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@anymux/file-system":"0.1.0"},"devDependencies":{"@types/node":"^22.10.2","tsdown":"^0.10.2","typescript":"^5.7.3","vitest":"^3.0.4","@anymux/typescript-config":"0.0.0"},"scripts":{"build":"tsdown","check":"tsc -p tsconfig.json --noEmit"},"_id":"@anymux/cache@0.1.0","bugs":{"url":"https://github.com/AnyMux/AnyMuxMonorepo/issues"},"_integrity":"sha512-9wmDSscagXwTmo7AdddOby8i/ExA/zU7RQtllSqBgYZRCx3jyh/SeRPJZmzTQu5cIxxxylgtT7t4Oylcor/H2A==","_resolved":"/tmp/72c17effacf84d05342b2e1acea102f1/anymux-cache-0.1.0.tgz","_from":"file:anymux-cache-0.1.0.tgz","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-9wmDSscagXwTmo7AdddOby8i/ExA/zU7RQtllSqBgYZRCx3jyh/SeRPJZmzTQu5cIxxxylgtT7t4Oylcor/H2A==","shasum":"28d1981717e13868dad5536df6e02cc83e839d71","tarball":"https://registry.npmjs.org/@anymux/cache/-/cache-0.1.0.tgz","fileCount":11,"unpackedSize":54034,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCyK1dAgsQPbEGqJ6P5JBL+2sXuZ9zqaIgbe+ZuoyWEXAIhAIjiFLnJw86RnKRJAinL3Y+JYjnUaPEtQrD84ruGKj7c"}]},"_npmUser":{"name":"yatsyk","email":"yatsyk@gmail.com"},"directories":{},"maintainers":[{"name":"yatsyk","email":"yatsyk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cache_0.1.0_1774335412794_0.24317045807981663"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-24T06:56:52.678Z","0.1.0":"2026-03-24T06:56:52.953Z","modified":"2026-03-24T06:56:53.239Z"},"maintainers":[{"name":"yatsyk","email":"yatsyk@gmail.com"}],"description":"Caching layer for AnyMux file systems","homepage":"https://github.com/AnyMux/AnyMuxMonorepo/tree/main/packages/cache#readme","keywords":["anymux","filesystem","cache","performance"],"repository":{"type":"git","url":"git+https://github.com/AnyMux/AnyMuxMonorepo.git","directory":"packages/cache"},"bugs":{"url":"https://github.com/AnyMux/AnyMuxMonorepo/issues"},"license":"MIT","readme":"# @anymux/cache\n\nCached file system wrapper for AnyMux. Transparent caching layer for any `IFileSystem` implementation.\n\n## Installation\n\n```bash\npnpm add @anymux/cache\n```\n\n## Usage\n\n```typescript\nimport { CachedFileSystem } from \"@anymux/cache\";\nimport { WebDavFileSystem } from \"@anymux/webdav\";\n\nconst remote = new WebDavFileSystem({ url: \"https://dav.example.com\" });\n\nconst fs = new CachedFileSystem(remote, {\n  maxSize: 50 * 1024 * 1024, // 50 MB cache\n  ttl: 60_000,               // 60 second TTL\n});\n\n// First read hits remote, subsequent reads served from cache\nconst content = await fs.readFile(\"/data.json\", \"utf-8\");\n```\n\n## API Overview\n\nWraps any `IFileSystem` with an in-memory cache to reduce remote calls.\n\n- **Read-through caching** — `readFile`, `stat`, `readdir` results are cached\n- **Write-through** — writes update both cache and backing store\n- **TTL-based expiry** — configurable time-to-live per entry\n- **Size limits** — LRU eviction when cache exceeds `maxSize`\n- **Manual invalidation** — `invalidate(path)` and `clear()` methods\n\n### Configuration\n\n- `maxSize` — Maximum cache size in bytes\n- `ttl` — Time-to-live in milliseconds\n- `cacheReaddirs` — Whether to cache directory listings (default: `true`)\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-6b589f55891aa28262c83a7b9d62f610"}