@deot/helper-cache
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

@deot/helper-cache

缓存管理(Storage / Cookie / IndexDB

Storage/Cookie/IndexDB

IndexDB 返回的是Promise

import { Cookie, Storage, IndexDB } from "@deot/helper-cache";

// or
import { Cookie, Storage, IndexDB } from "@deot/helper";

get

Storage.get(key: string, options?: object)

获取缓存中对应的值

  • key: 键值
  • options: 配置项

示例

Storage.get('key');

set

Storage.set(key: string, value: any, options?: object)

设置缓存

  • key: 键值
  • value: 缓存
  • options: 配置项

示例

Storage.set('key', {});

remove

Storage.remove(key: string, options?: object)

清楚缓存

  • key: 键值
  • options: 配置项

示例

Storage.remove('key');

configure

Storage.configure(options: object)

设置版本号

  • options: 配置项

示例

Storage.configure({ version: '1.0.0' });

Readme

Keywords

none

Package Sidebar

Install

npm i @deot/helper-cache

Weekly Downloads

5

Version

1.1.3

License

MIT

Unpacked Size

50.8 kB

Total Files

7

Last publish

Collaborators

  • deot