1 | import { IStorage, IStorageStrategy, StorageDependencies, StorageOptions } from './definitions';
|
2 |
|
3 |
|
4 |
|
5 | export declare class LocalStorageStrategy implements IStorageStrategy {
|
6 | get(key: string): string;
|
7 | set(key: string, value: string): void;
|
8 | delete(key: string): void;
|
9 | }
|
10 |
|
11 |
|
12 |
|
13 | export declare class SessionStorageStrategy implements IStorageStrategy {
|
14 | get(key: string): string;
|
15 | set(key: string, value: string): void;
|
16 | delete(key: string): void;
|
17 | }
|
18 |
|
19 |
|
20 |
|
21 | export declare class Storage<T> implements IStorage<T> {
|
22 | options: StorageOptions;
|
23 | |
24 |
|
25 |
|
26 | private strategy;
|
27 | |
28 |
|
29 |
|
30 | private storageCache;
|
31 | constructor(deps: StorageDependencies, options?: StorageOptions);
|
32 | /**
|
33 | * Set a value in the storage by the given key.
|
34 | *
|
35 | * @param key - The storage key to set.
|
36 | * @param value - The value to set. (Must be JSON-serializable).
|
37 | */
|
38 | set(key: string, value: T): void;
|
39 | /**
|
40 | * Delete a value from the storage by the given key.
|
41 | *
|
42 | * @param key - The storage key to delete.
|
43 | */
|
44 | delete(key: string): void;
|
45 | /**
|
46 | * Get a value from the storage by the given key.
|
47 | *
|
48 | * @param key - The storage key to get.
|
49 | */
|
50 | get(key: string): T;
|
51 | /**
|
52 | * @private
|
53 | */
|
54 | private standardizeKey(key);
|
55 | }
|