Skip to content

Commit f0d77af

Browse files
committed
updated types for persistance and replaced bun-types with @types/bun
1 parent 862e424 commit f0d77af

File tree

4 files changed

+45
-43
lines changed

4 files changed

+45
-43
lines changed

bun.lockb

786 Bytes
Binary file not shown.

dist/index.d.ts

+42-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
1-
// Generated by dts-bundle-generator v8.0.1
2-
1+
/**
2+
* A class representing a cache using Bun's SQLite.
3+
*/
34
declare class BunCache {
4-
private cache;
5-
/**
6-
* Creates a new instance of the BunCache class.
7-
*/
8-
constructor();
9-
/**
10-
* Initializes the cache schema.
11-
*/
12-
private initializeSchema;
13-
/**
14-
* Retrieves the value associated with a key from the cache.
15-
* @param key - The key for which to fetch the value.
16-
* @returns The value if the key exists and hasn't expired, `null` otherwise.
17-
*/
18-
get(key: string): string | object | boolean | null;
19-
/**
20-
* Adds a value to the cache.
21-
* @param key - The key under which to store the value.
22-
* @param value - The value to be stored.
23-
* @param ttl - The time-to-live for the value, in milliseconds.
24-
* @returns `true` if the value was successfully stored, `false` otherwise.
25-
*/
26-
put(key: string, value: string | object | null, ttl: number): boolean;
27-
/**
28-
* Removes a key from the cache.
29-
* @param key - The key to be deleted.
30-
* @returns `true` if the key was successfully deleted, `false` otherwise.
31-
*/
32-
delete(key: string): boolean;
5+
private cache;
6+
/**
7+
* Creates a new instance of the BunCache class.
8+
*/
9+
constructor(persistance?: boolean);
10+
/**
11+
* Initializes the cache schema.
12+
*/
13+
private initializeSchema;
14+
/**
15+
* Retrieves the value associated with a key from the cache.
16+
* @param key - The key for which to fetch the value.
17+
* @returns The value if the key exists and hasn't expired, `null` otherwise.
18+
*/
19+
get(key: string): string | object | boolean | null;
20+
/**
21+
* Adds a value to the cache.
22+
* @param key - The key under which to store the value.
23+
* @param value - The value to be stored.
24+
* @param ttl - The time-to-live for the value, in milliseconds.
25+
* @returns `true` if the value was successfully stored, `false` otherwise.
26+
*/
27+
put(key: string, value: string | object | null, ttl?: number): boolean;
28+
/**
29+
* Removes a key from the cache.
30+
* @param key - The key to be deleted.
31+
* @returns `true` if the key was successfully deleted, `false` otherwise.
32+
*/
33+
delete(key: string): boolean;
34+
/**
35+
* Checks if a key exists in the cache.
36+
* @param key - The key to be checked
37+
* @returns `true` if the key exists, `false` otherwise
38+
*/
39+
hasKey(key: string): boolean;
3340
}
41+
export default BunCache;
3442
export interface CacheSchema {
35-
key: string;
36-
value: string | null;
37-
ttl: number;
43+
key: string;
44+
value: string | null;
45+
ttl: number | null;
3846
}
39-
40-
export {
41-
BunCache as default,
42-
};
43-
44-
export {};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@samocodes/bun-cache",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"private": false,
55
"author": "Samir <[email protected]>",
66
"repository": {
@@ -9,7 +9,7 @@
99
"main": "dist/index.js",
1010
"module": "dist/index.js",
1111
"devDependencies": {
12-
"bun-types": "^1.1.12"
12+
"@types/bun": "^1.1.6"
1313
},
1414
"peerDependencies": {
1515
"typescript": "^5.4.5"

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
"allowSyntheticDefaultImports": true,
1616
"forceConsistentCasingInFileNames": true,
1717
"allowJs": true,
18-
"types": ["bun-types"]
18+
"types": ["@types/bun"]
1919
}
2020
}

0 commit comments

Comments
 (0)