cachemap
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

cachemap

An isomorphic cache that can use Redis, LocalStorage, IndexedDB or an in-memory Map.

Build Status codecov Quality Gate License: MIT npm version dependencies Status devDependencies Status

Summary

  • Use Redis or an in-memory Map on the server.
  • Use LocalStorage, IndexedDB or an in-memory Map on the client.
  • Export/import entries and metadata from one Cachemap to another.
  • Store data alongside cache-control directives, etag and uuid (tag).
  • Cache headers used to derive whether data is fresh or stale.
  • Sort stored data based on metadata values.
  • Build-in reaper to cull stale data at specified intervals.
  • Set approximate maximum memory size for data.
  • Use on main thread or as web worker in browser.

Installation

yarn add cachemap

Compilation

The WEB_ENV environment variable must be set to 'true' when you compile your browser bundle in order to exclude Redis from the build.

Documentation

Additional documentation can be found on the Cachemap github pages.

Web worker interface

You can run Cachemap in a web worker by using WorkerCachemap as the Cachemap interface in your bundle on the main thread and { worker-cachemap.worker: ./node_modules/cachemap/lib/browser/worker.js } as the entry point for your bundle on the worker thread.

Changelog

Check out the features, fixes and more that go into each major, minor and patch version.

License

Cachemap is MIT Licensed.

Package Sidebar

Install

npm i cachemap

Weekly Downloads

12

Version

0.3.0

License

MIT

Unpacked Size

2.87 MB

Total Files

164

Last publish

Collaborators

  • dylanaubrey