Skip to content

Releases: caijf/cache2

v3.1.2

19 Nov 03:06
Compare
Choose a tag to compare
  • feat: 支持单个实例缓存多种数据类型

get set mget mset getAll take 等实例方法支持泛型。

例如:

const myCache = new Cache();

myCache.get<string>(key1);
myCache.get<number>(key2);

v2.0.7

22 Oct 03:17
Compare
Choose a tag to compare
  • chore: 提示调整

v3.1.1

19 Nov 03:03
Compare
Choose a tag to compare
  • feat: 优化文档和类型提示

v3.1.0

09 Sep 06:12
Compare
Choose a tag to compare
  • feat: Storage 支持 prefix 配置

v3.0.1

02 Sep 09:04
Compare
Choose a tag to compare
  • chore: 类型调整

v3.0.0

17 Jun 09:18
Compare
Choose a tag to compare
  • feat: 移除废弃模块 local session

由于原 local sessionStorage 实例不会触发 Tree shaking ,因此移除。

建议使用以下方式自定义 localsession

import { Storage } from 'cache2';

// const session = new Storage(window.sessionStorage); // 使用方法同 local
const local = new Storage(window.localStorage);

local.set('foo', { a: 1, b: ['bar'], c: ['x', 2, 3] });
local.get('foo'); // { a: 1, b: ['bar'], c: ['x', 2, 3] }

local.del('foo');
local.get('foo'); // undefined

v2.0.6

17 Jun 09:01
Compare
Choose a tag to compare
  • chore: 将 local session 标识为即将废弃

建议使用以下方式

import { Storage } from 'cache2';

// const session = new Storage(window.sessionStorage);
const local = new Storage(window.localStorage);

local.set('foo', { a: 1, b: ['bar'], c: ['x', 2, 3] });
local.get('foo'); // { a: 1, b: ['bar'], c: ['x', 2, 3] }

local.del('foo');
local.get('foo'); // undefined

v2.0.5

14 May 08:50
Compare
Choose a tag to compare
  • refactor: 优化内部缓存逻辑(⚠️ Cache 的命名空间默认值为 namespace="default",之前版本如果使用内存缓存,并且有多个不同实例,相互之间可能会有影响)

v2.0.4

13 May 03:51
Compare
Choose a tag to compare
  • refactor: 导出缓存配置类型

v2.0.3

19 Mar 02:44
Compare
Choose a tag to compare
  • refactor: 内存缓存的键支持空字符串前缀