|
1 |
| -// Generated by dts-bundle-generator v8.0.1 |
2 |
| - |
| 1 | +/** |
| 2 | + * A class representing a cache using Bun's SQLite. |
| 3 | + */ |
3 | 4 | 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; |
33 | 40 | }
|
| 41 | +export default BunCache; |
34 | 42 | export interface CacheSchema {
|
35 |
| - key: string; |
36 |
| - value: string | null; |
37 |
| - ttl: number; |
| 43 | + key: string; |
| 44 | + value: string | null; |
| 45 | + ttl: number | null; |
38 | 46 | }
|
39 |
| - |
40 |
| -export { |
41 |
| - BunCache as default, |
42 |
| -}; |
43 |
| - |
44 |
| -export {}; |
|
0 commit comments