Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

local-cache-storage

Maintainability Test Coverage Build

Installing

npm

npm install local-cache-storage

yarn

yarn add local-cache-storage

How to use?

ES6 Modules

import * as localCache from 'local-cache-storage';

localCache.set('key', 'value', 3000);

CommonJS

const localCache = require('local-cache-storage');

localCache.get('key', true);

Example

import * as localCache from 'local-cache-storage';

const DAY = 1000 * 60 * 60 * 24;

localCache.set('foo', 'bar'); // If you want to save permanently.
localCache.set('counts', [1, 2, 3], 5 * DAY); // Key will be remained for five days.

localCache.get('counts'); // '[1, 2, 3]'

// If you want to get parsed value.
localCache.get('counts', true); // [1, 2, 3]

// After 6 days
localCache.get('counts'); // null
localCache.get('counts', true); // null

Releases

Packages

Used by

Contributors

Languages