@linkedmink/multilevel-aging-cache
Version:
Package provides an interface to cache and persist data to Redis, MongoDB, memory
20 lines (17 loc) • 449 B
text/typescript
/**
* @param data The data to convert
* @return The input data as a string
*/
export type SerializeFunction<T> = (data: T) => string;
/**
* @param data The data to convert
* @return The input data as an object
*/
export type DeserializeFunction<T> = (data: string) => T;
/**
* Implement converting a data type from/to strings
*/
export interface ISerializer<T> {
serialize: SerializeFunction<T>;
deserialize: DeserializeFunction<T>;
}