@lgd-utils/cached-storage
TypeScript icon, indicating that this package has built-in type declarations

0.0.17 • Public • Published

@lgd-utils/cached-storage

Bundle size MIT NPM downloads NPM version lodash npm styled with prettier

一个具有失效功能的缓存存储库

Usage

const CachedStorage = require('@lgd-utils/cached-storage').default;

const cachedStorage = new CachedStorage();

cachedStorage.setItem('__TEST_KEY__', '__TEST_VALUE__', 2);

cachedStorage.getItem('__TEST_KEY__'); // '__TEST_VALUE__'
setTimeout (function () {
  cachedStorage.getItem('__TEST_KEY__'); // null
}, 1000 * 60 * 2)

Thanks

灵感来源于 lscache,原库只有 localStorage,现扩展支持 localStorage / sessionStorage / memoryStorage

Contribute

Documentation

Related

Package Sidebar

Install

npm i @lgd-utils/cached-storage

Weekly Downloads

0

Version

0.0.17

License

MIT

Unpacked Size

376 kB

Total Files

11

Last publish

Collaborators

  • lgd.huafeeng