Documentation generated by ChatGPT:
A simple key-value store that uses Redis for storage and supports optional encryption and compression of stored values.
Dependencies:
- Redis
- Dotenv
- Zlib
Functions:
-
get(key: string): Promise<any>
- Retrieves the value for the given key from the store.
- Returns a promise that resolves with the value. If the key does not exist, the promise resolves with null.
-
set(key: string, value: any): Promise<void>
- Stores the given value in the store under the given key.
- Returns a promise that resolves when the value has been stored.
-
watcher(key: string, log_time: boolean, callback: (value: any) => void, saved_update_time?: string): void
- Monitors the given key for updates and executes the given callback function when the key is updated.
- If
log_time
is true, the update time for the key will be logged to the console when the key is updated. - The
saved_update_time
argument is optional and should only be provided if you want to initialize the saved update time with a specific value.
Exported objects:
client: RedisClient
- The Redis client instance used by the key-value store.