Skip to content

Commit 43b97a6

Browse files
authored
fix(deps): replace lru-cache with toad-cache (#654)
1 parent 7861dd5 commit 43b97a6

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

package-lock.json

+10-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@octokit/request": "^9.1.1",
3232
"@octokit/request-error": "^6.1.1",
3333
"@octokit/types": "^13.4.1",
34-
"lru-cache": "npm:@wolfy1339/lru-cache@^11.0.2-patch.1",
34+
"toad-cache": "^3.7.0",
3535
"universal-github-app-jwt": "^2.2.0",
3636
"universal-user-agent": "^7.0.0"
3737
},

src/cache.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// https://github.com/isaacs/node-lru-cache#readme
2-
import { LRUCache } from "lru-cache";
1+
import { Lru } from "toad-cache";
32

43
/* v8 ignore next */
54
import type {
@@ -12,12 +11,12 @@ import type {
1211
} from "./types.js";
1312

1413
export function getCache() {
15-
return new LRUCache<number, string>({
14+
return new Lru<string>(
1615
// cache max. 15000 tokens, that will use less than 10mb memory
17-
max: 15000,
16+
15000,
1817
// Cache for 1 minute less than GitHub expiry
19-
ttl: 1000 * 60 * 59,
20-
});
18+
1000 * 60 * 59,
19+
);
2120
}
2221

2322
export async function get(

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type * as OctokitTypes from "@octokit/types";
2-
import type { LRUCache } from "lru-cache";
2+
import type { Lru } from "toad-cache";
33
import type * as OAuthAppAuth from "@octokit/auth-oauth-app";
44

55
// STRATEGY OPTIONS
@@ -134,7 +134,7 @@ export type Route = OctokitTypes.Route;
134134
export type RequestInterface = OctokitTypes.RequestInterface;
135135

136136
export type Cache =
137-
| LRUCache<string, string>
137+
| Lru<string>
138138
| {
139139
get: (key: string) => string | Promise<string>;
140140
set: (key: string, value: string) => any;

0 commit comments

Comments
 (0)