@aomex/cache 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/package.json +32 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @aomex/cache
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e652c3f`](https://github.com/aomex/aomex/commit/e652c3f44eb780711ff475e18ecbb506adfd8a9a) Thanks [@geekact](https://github.com/geekact)! - fix(storage): 内存缓存的最大数量不能是 Infinity
|
|
8
|
+
|
|
9
|
+
- [`e8dee7c`](https://github.com/aomex/aomex/commit/e8dee7c3f064587cd2afb9cb95ab3341f63ccd27) Thanks [@geekact](https://github.com/geekact)! - refactor: 重命名 storage 为 cache
|
|
10
|
+
|
|
11
|
+
## 0.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d1ce4e2`](https://github.com/aomex/aomex/commit/d1ce4e2276f93c44e67ea06666d048917fa94e53) Thanks [@geekact](https://github.com/geekact)! - 增加 storage 存储基础类
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 geekact
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
interface CacheOptions {
|
|
2
|
+
keyPrefix?: string;
|
|
3
|
+
}
|
|
4
|
+
declare abstract class Cache {
|
|
5
|
+
protected readonly keyPrefix: string;
|
|
6
|
+
constructor(config: CacheOptions);
|
|
7
|
+
/**
|
|
8
|
+
* 指定key是否存在并且没过期
|
|
9
|
+
*/
|
|
10
|
+
exists(key: string): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* 获取指定key的值。值不存在时返回默认值,无默认值则返回`null`
|
|
13
|
+
* ```typescript
|
|
14
|
+
* await cache.get('non-exist'); // null
|
|
15
|
+
* await cache.get('non-exist', 'my-value'); // my-value
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
get<T>(key: string, defaultValue: T): Promise<T>;
|
|
19
|
+
get<T extends string | number | object | boolean>(key: string): Promise<T | null>;
|
|
20
|
+
/**
|
|
21
|
+
* 获取或写入指定key的值。
|
|
22
|
+
*
|
|
23
|
+
* 如果值存在,则立即返回。如果值不存在,则返回回调函数中获取的数据并写入缓存。
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* await cache.getOrSet('my-key', () => 'my-value');
|
|
27
|
+
* // 支持异步回调
|
|
28
|
+
* await cache.getOrSet('my-key', async () => 'my-value');
|
|
29
|
+
* // 保质期3600ms,即一小时
|
|
30
|
+
* await cache.getOrSet('my-key', () => 'my-value', 3600);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
getOrSet<T extends string | number | object | boolean>(key: string, orSet: () => T, duration?: number): Promise<T>;
|
|
34
|
+
getOrSet<T extends string | number | object | boolean>(key: string, orSet: () => Promise<T>, duration?: number): Promise<T>;
|
|
35
|
+
/**
|
|
36
|
+
* 缓存写入指定key的值
|
|
37
|
+
*
|
|
38
|
+
* ```typescript
|
|
39
|
+
* await cache.set('key', 'value');
|
|
40
|
+
* // 保质期3600ms,即一小时
|
|
41
|
+
* await cache.set('key', 'value', 3600);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
set(key: string, value: string | number | object | boolean, duration?: number): Promise<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* 缓存写入指定key的值。如果key已经有值,则无法写入并返回false
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // 首次写入成功,立即再次写入相同key失败
|
|
49
|
+
* await cache.add('key', 'value'); // true
|
|
50
|
+
* await cache.add('key', 'value'); // false
|
|
51
|
+
* // 保质期3600ms,即一小时,一小时后允许再设置
|
|
52
|
+
* await cache.add('key-1', 'value', 3600); // true
|
|
53
|
+
* await sleep(3600);
|
|
54
|
+
* await cache.add('key-1', 'value'); // true
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
add(key: string, value: any, duration?: number): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* 删除指定缓存
|
|
60
|
+
*/
|
|
61
|
+
delete(key: string): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* 删除该实例下的所有缓存
|
|
64
|
+
*/
|
|
65
|
+
deleteAll(): Promise<boolean>;
|
|
66
|
+
protected buildKey(key: string): string;
|
|
67
|
+
protected addValue(key: string, value: string, duration?: number): Promise<boolean>;
|
|
68
|
+
protected abstract existsKey(key: string): Promise<boolean>;
|
|
69
|
+
protected abstract getValue(key: string): Promise<string | null>;
|
|
70
|
+
protected abstract setValue(key: string, value: string, duration?: number): Promise<boolean>;
|
|
71
|
+
protected abstract deleteValue(key: string): Promise<boolean>;
|
|
72
|
+
protected abstract deleteAllValues(): Promise<boolean>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface MemoryCacheOptions extends CacheOptions {
|
|
76
|
+
/**
|
|
77
|
+
* 缓存的最大数量。默认:`1000`
|
|
78
|
+
*/
|
|
79
|
+
maxItems?: number;
|
|
80
|
+
gcProbability?: number;
|
|
81
|
+
}
|
|
82
|
+
declare class MemoryCache extends Cache {
|
|
83
|
+
private readonly lru;
|
|
84
|
+
protected readonly gcProbability: number;
|
|
85
|
+
constructor(options?: MemoryCacheOptions);
|
|
86
|
+
protected existsKey(key: string): Promise<boolean>;
|
|
87
|
+
protected getValue(key: string): Promise<string | null>;
|
|
88
|
+
protected setValue(key: string, value: string, duration?: number): Promise<boolean>;
|
|
89
|
+
protected deleteValue(key: string): Promise<boolean>;
|
|
90
|
+
protected deleteAllValues(): Promise<boolean>;
|
|
91
|
+
protected gc(): void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { Cache, CacheOptions, MemoryCache, MemoryCacheOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// src/cache.ts
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
var Cache = class {
|
|
4
|
+
keyPrefix;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.keyPrefix = config.keyPrefix ?? "";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 指定key是否存在并且没过期
|
|
10
|
+
*/
|
|
11
|
+
async exists(key) {
|
|
12
|
+
return this.existsKey(this.buildKey(key));
|
|
13
|
+
}
|
|
14
|
+
async get(key, defaultValue) {
|
|
15
|
+
const hashKey = this.buildKey(key);
|
|
16
|
+
let result = await this.getValue(hashKey);
|
|
17
|
+
if (result === null) {
|
|
18
|
+
return defaultValue === void 0 ? null : defaultValue;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(result);
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async getOrSet(key, orSet, duration) {
|
|
27
|
+
let value = await this.get(key);
|
|
28
|
+
if (value !== null)
|
|
29
|
+
return value;
|
|
30
|
+
value = await orSet();
|
|
31
|
+
await this.set(key, value, duration);
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 缓存写入指定key的值
|
|
36
|
+
*
|
|
37
|
+
* ```typescript
|
|
38
|
+
* await cache.set('key', 'value');
|
|
39
|
+
* // 保质期3600ms,即一小时
|
|
40
|
+
* await cache.set('key', 'value', 3600);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
async set(key, value, duration) {
|
|
44
|
+
const hashKey = this.buildKey(key);
|
|
45
|
+
const wrappedValue = JSON.stringify(value);
|
|
46
|
+
return this.setValue(hashKey, wrappedValue, duration);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 缓存写入指定key的值。如果key已经有值,则无法写入并返回false
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // 首次写入成功,立即再次写入相同key失败
|
|
52
|
+
* await cache.add('key', 'value'); // true
|
|
53
|
+
* await cache.add('key', 'value'); // false
|
|
54
|
+
* // 保质期3600ms,即一小时,一小时后允许再设置
|
|
55
|
+
* await cache.add('key-1', 'value', 3600); // true
|
|
56
|
+
* await sleep(3600);
|
|
57
|
+
* await cache.add('key-1', 'value'); // true
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
async add(key, value, duration) {
|
|
61
|
+
const hashKey = this.buildKey(key);
|
|
62
|
+
const wrappedValue = JSON.stringify(value);
|
|
63
|
+
return this.addValue(hashKey, wrappedValue, duration);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 删除指定缓存
|
|
67
|
+
*/
|
|
68
|
+
async delete(key) {
|
|
69
|
+
const hashKey = this.buildKey(key);
|
|
70
|
+
return this.deleteValue(hashKey);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 删除该实例下的所有缓存
|
|
74
|
+
*/
|
|
75
|
+
async deleteAll() {
|
|
76
|
+
return this.deleteAllValues();
|
|
77
|
+
}
|
|
78
|
+
buildKey(key) {
|
|
79
|
+
const hashKey = key.length <= 32 ? key : createHash("md5").update(key).digest("hex");
|
|
80
|
+
return this.keyPrefix + hashKey;
|
|
81
|
+
}
|
|
82
|
+
async addValue(key, value, duration) {
|
|
83
|
+
return await this.existsKey(key) ? false : this.setValue(key, value, duration);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// src/memory-cache.ts
|
|
88
|
+
import LRU from "lru-cache";
|
|
89
|
+
var MemoryCache = class extends Cache {
|
|
90
|
+
lru;
|
|
91
|
+
gcProbability;
|
|
92
|
+
constructor(options = {}) {
|
|
93
|
+
super(options);
|
|
94
|
+
this.gcProbability = (options.gcProbability ?? 10) / 100;
|
|
95
|
+
this.lru = new LRU({
|
|
96
|
+
max: options.maxItems || 1e3
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
async existsKey(key) {
|
|
100
|
+
return this.lru.has(key);
|
|
101
|
+
}
|
|
102
|
+
async getValue(key) {
|
|
103
|
+
const data = this.lru.get(key);
|
|
104
|
+
return data === void 0 ? null : data;
|
|
105
|
+
}
|
|
106
|
+
async setValue(key, value, duration) {
|
|
107
|
+
this.gc();
|
|
108
|
+
this.lru.set(key, value, {
|
|
109
|
+
ttl: duration
|
|
110
|
+
});
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
async deleteValue(key) {
|
|
114
|
+
return this.lru.delete(key);
|
|
115
|
+
}
|
|
116
|
+
async deleteAllValues() {
|
|
117
|
+
this.lru.clear();
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
gc() {
|
|
121
|
+
if (Math.random() > this.gcProbability)
|
|
122
|
+
return;
|
|
123
|
+
this.lru.purgeStale();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
Cache,
|
|
128
|
+
MemoryCache
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cache.ts","../src/memory-cache.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\n\nexport interface CacheOptions {\n keyPrefix?: string;\n}\n\nexport abstract class Cache {\n protected readonly keyPrefix: string;\n\n constructor(config: CacheOptions) {\n this.keyPrefix = config.keyPrefix ?? '';\n }\n\n /**\n * 指定key是否存在并且没过期\n */\n async exists(key: string): Promise<boolean> {\n return this.existsKey(this.buildKey(key));\n }\n\n /**\n * 获取指定key的值。值不存在时返回默认值,无默认值则返回`null`\n * ```typescript\n * await cache.get('non-exist'); // null\n * await cache.get('non-exist', 'my-value'); // my-value\n * ```\n */\n async get<T>(key: string, defaultValue: T): Promise<T>;\n async get<T extends string | number | object | boolean>(\n key: string,\n ): Promise<T | null>;\n async get(\n key: string,\n defaultValue?: string | number | object | boolean,\n ): Promise<any> {\n const hashKey = this.buildKey(key);\n let result = await this.getValue(hashKey);\n\n if (result === null) {\n return defaultValue === undefined ? null : defaultValue;\n }\n\n try {\n return JSON.parse(result);\n } catch {\n return null;\n }\n }\n\n /**\n * 获取或写入指定key的值。\n *\n * 如果值存在,则立即返回。如果值不存在,则返回回调函数中获取的数据并写入缓存。\n *\n * ```typescript\n * await cache.getOrSet('my-key', () => 'my-value');\n * // 支持异步回调\n * await cache.getOrSet('my-key', async () => 'my-value');\n * // 保质期3600ms,即一小时\n * await cache.getOrSet('my-key', () => 'my-value', 3600);\n * ```\n */\n async getOrSet<T extends string | number | object | boolean>(\n key: string,\n orSet: () => T,\n duration?: number,\n ): Promise<T>;\n async getOrSet<T extends string | number | object | boolean>(\n key: string,\n orSet: () => Promise<T>,\n duration?: number,\n ): Promise<T>;\n async getOrSet<T extends string | number | object | boolean>(\n key: string,\n orSet: () => T | Promise<T>,\n duration?: number,\n ): Promise<T> {\n let value: T | null = await this.get(key);\n\n if (value !== null) return value;\n\n value = await orSet();\n await this.set(key, value, duration);\n return value;\n }\n\n /**\n * 缓存写入指定key的值\n *\n * ```typescript\n * await cache.set('key', 'value');\n * // 保质期3600ms,即一小时\n * await cache.set('key', 'value', 3600);\n * ```\n */\n async set(\n key: string,\n value: string | number | object | boolean,\n duration?: number,\n ): Promise<boolean> {\n const hashKey = this.buildKey(key);\n const wrappedValue = JSON.stringify(value);\n return this.setValue(hashKey, wrappedValue, duration);\n }\n\n /**\n * 缓存写入指定key的值。如果key已经有值,则无法写入并返回false\n * ```typescript\n * // 首次写入成功,立即再次写入相同key失败\n * await cache.add('key', 'value'); // true\n * await cache.add('key', 'value'); // false\n * // 保质期3600ms,即一小时,一小时后允许再设置\n * await cache.add('key-1', 'value', 3600); // true\n * await sleep(3600);\n * await cache.add('key-1', 'value'); // true\n * ```\n */\n async add(key: string, value: any, duration?: number): Promise<boolean> {\n const hashKey = this.buildKey(key);\n const wrappedValue = JSON.stringify(value);\n return this.addValue(hashKey, wrappedValue, duration);\n }\n\n /**\n * 删除指定缓存\n */\n async delete(key: string): Promise<boolean> {\n const hashKey = this.buildKey(key);\n return this.deleteValue(hashKey);\n }\n\n /**\n * 删除该实例下的所有缓存\n */\n async deleteAll(): Promise<boolean> {\n return this.deleteAllValues();\n }\n\n protected buildKey(key: string): string {\n const hashKey =\n key.length <= 32 ? key : createHash('md5').update(key).digest('hex');\n return this.keyPrefix + hashKey;\n }\n\n protected async addValue(\n key: string,\n value: string,\n duration?: number,\n ): Promise<boolean> {\n return (await this.existsKey(key))\n ? false\n : this.setValue(key, value, duration);\n }\n\n protected abstract existsKey(key: string): Promise<boolean>;\n protected abstract getValue(key: string): Promise<string | null>;\n protected abstract setValue(\n key: string,\n value: string,\n duration?: number,\n ): Promise<boolean>;\n protected abstract deleteValue(key: string): Promise<boolean>;\n protected abstract deleteAllValues(): Promise<boolean>;\n}\n","import LRU from 'lru-cache';\nimport { Cache, CacheOptions } from './cache';\n\nexport interface MemoryCacheOptions extends CacheOptions {\n /**\n * 缓存的最大数量。默认:`1000`\n */\n maxItems?: number;\n gcProbability?: number;\n}\n\nexport class MemoryCache extends Cache {\n private readonly lru: LRU<string, string>;\n protected readonly gcProbability: number;\n\n constructor(options: MemoryCacheOptions = {}) {\n super(options);\n this.gcProbability = (options.gcProbability ?? 10) / 100;\n this.lru = new LRU<string, string>({\n max: options.maxItems || 1000,\n });\n }\n\n protected override async existsKey(key: string): Promise<boolean> {\n return this.lru.has(key);\n }\n\n protected async getValue(key: string): Promise<string | null> {\n const data = this.lru.get(key);\n return data === undefined ? null : data;\n }\n\n protected async setValue(\n key: string,\n value: string,\n duration?: number,\n ): Promise<boolean> {\n this.gc();\n this.lru.set(key, value, {\n ttl: duration,\n });\n return true;\n }\n\n protected async deleteValue(key: string): Promise<boolean> {\n return this.lru.delete(key);\n }\n\n protected async deleteAllValues(): Promise<boolean> {\n this.lru.clear();\n return true;\n }\n\n protected gc() {\n if (Math.random() > this.gcProbability) return;\n this.lru.purgeStale();\n }\n}\n"],"mappings":"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","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aomex/cache",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"package.json",
|
|
21
|
+
"README.md",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"repository": "git@github.com:aomex/aomex.git",
|
|
26
|
+
"homepage": "https://aomex.js.org",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"lru-cache": "^7.14.1"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {}
|
|
32
|
+
}
|