Skip to content

Commit 2de1129

Browse files
committed
wip(LRUCache): 更新 reason 的类型
1 parent 8112316 commit 2de1129

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.github/workflows/node-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ jobs:
2828
name: Node ${{ matrix.node-version }} on ${{ matrix.os }}
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@v4
3232
with:
3333
submodules: 'recursive'
3434

3535
- name: Install Node.js
36-
uses: actions/setup-node@v3
36+
uses: actions/setup-node@v4
3737
with:
3838
node-version: ${{ matrix.node-version }}
3939
# cache: 'pnpm'
4040

41-
- uses: pnpm/action-setup@v2
41+
- uses: pnpm/action-setup@v4
4242
with:
43-
version: 8
43+
version: 9
4444

4545
- name: Install dependencies
4646
run: pnpm install --ignore-scripts

.github/workflows/npm-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ jobs:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
with:
2323
submodules: 'recursive'
2424

2525
- name: Install Node.js
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
node-version: 20
2929
registry-url: https://registry.npmjs.com
3030

31-
- uses: pnpm/action-setup@v2
31+
- uses: pnpm/action-setup@v4
3232
name: Install pnpm
3333
id: pnpm-install
3434
with:
35-
version: 8
35+
version: 9
3636
run_install: false
3737

3838
- name: Get pnpm store directory

src/common/lib/LRUCache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// @see https://www.npmjs.com/package/lru-cache
2-
2+
type DisposeReason = 'set' | 'delete' | 'evict' | 'expired';
33
export interface LRUCacheOptions<K = string, V = unknown> {
44
/** The maximum number of items that remain in the cache. default 500 */
55
max?: number;
66
/** how long to live in ms. default 0 */
77
ttl?: number;
88
updateAgeOnGet?: boolean;
99
/** Function that is called on items when they are dropped from the cache */
10-
dispose?(val: LRUCacheItem<V>, key: K, reason: string): void;
10+
dispose?(val: LRUCacheItem<V>, key: K, reason: DisposeReason): void;
1111
}
1212

1313
interface LRUCacheItem<V> {
@@ -65,7 +65,7 @@ export class LRUCache<K = string, V = unknown> {
6565
return value.v as T;
6666
}
6767
/** Deletes a key out of the cache */
68-
delete(key: K, reason = 'delete') {
68+
delete(key: K, reason: DisposeReason = 'delete') {
6969
if (!this.cache.has(key)) return false;
7070
const val = this.cache.get(key);
7171
this.cache.delete(key);

0 commit comments

Comments
 (0)