npm.io
1.0.5 • Published 7 years ago

encrypt-async-cache

Licence
ISC
Version
1.0.5
Deps
3
Size
244 kB
Vulns
0
Weekly
0



async-encrypted-disk-cache

An encrypted async disk caching module

Coverage Status

Install

$ npm install encrypt-async-cache

Usage

const FileSystemCache = require("encrypt-async-cache").FileSystemCache;

Example



const myCache = new FileSystemCache("my-cache", "my-secret-key");

myCache.set("firstCache", "This is the data").then(success => {
  success === true;
  // item is put into cache
});


myCache.get("firstCache").then(cachedItem => {
  cachedItem === "This is the data";
  // item is retrieved from the cache
});


myCache.remove("firstCache").then(hasRemoved => {
  hasRemoved === true;
  // item is removed from the cache directory
});

myCache.clear().then(hasCleared => {
  hasCleared === true;
  // your cache directory has been cleared
});