Add support for jobs & queueables, migrations
- Create migration directives & migrators - Modify Cache classes to support array manipulation - Create Redis unit and RedisCache implementation - Create Queueable base class and Queue class that uses Cache backend
This commit is contained in:
37
src/util/cache/Cache.ts
vendored
37
src/util/cache/Cache.ts
vendored
@@ -15,8 +15,9 @@ export abstract class Cache {
|
||||
* Store the given value in the cache by key.
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
* @param expires
|
||||
*/
|
||||
public abstract put(key: string, value: string): Awaitable<void>;
|
||||
public abstract put(key: string, value: string, expires?: Date): Awaitable<void>;
|
||||
|
||||
/**
|
||||
* Check if the cache has the given key.
|
||||
@@ -30,4 +31,38 @@ export abstract class Cache {
|
||||
* @param {string} key
|
||||
*/
|
||||
public abstract drop(key: string): Awaitable<void>;
|
||||
|
||||
/**
|
||||
* Fetch an item from the cache by key, and then remove it.
|
||||
* @param key
|
||||
*/
|
||||
public abstract pop(key: string): Awaitable<string|undefined>;
|
||||
|
||||
/**
|
||||
* Increment a key in the cache by a given amount.
|
||||
* @param key
|
||||
* @param amount
|
||||
*/
|
||||
public abstract increment(key: string, amount?: number): Awaitable<number|undefined>;
|
||||
|
||||
/**
|
||||
* Decrement a key in the cache by a given amount.
|
||||
* @param key
|
||||
* @param amount
|
||||
*/
|
||||
public abstract decrement(key: string, amount?: number): Awaitable<number|undefined>;
|
||||
|
||||
/**
|
||||
* Push an item onto the end an array-like key.
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public abstract arrayPush(key: string, value: string): Awaitable<void>;
|
||||
|
||||
/**
|
||||
* Remove and return an item from the beginning of an array-like key.
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
public abstract arrayPop(key: string): Awaitable<string|undefined>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user