mirror of
https://github.com/seejohnrun/haste-server.git
synced 2025-12-20 08:11:28 +00:00
26 lines
508 B
TypeScript
26 lines
508 B
TypeScript
import { BaseStoreConfig } from 'src/types/config'
|
|
|
|
export type Callback = (data: boolean | string) => void
|
|
|
|
export abstract class Store {
|
|
type: string
|
|
|
|
expire?: number
|
|
|
|
constructor(config: BaseStoreConfig) {
|
|
this.type = config.type
|
|
if (this.expire) {
|
|
this.expire = config.expire
|
|
}
|
|
}
|
|
|
|
abstract get: (key: string, callback: Callback, skipExpire?: boolean) => void
|
|
|
|
abstract set: (
|
|
key: string,
|
|
data: string,
|
|
callback: Callback,
|
|
skipExpire?: boolean
|
|
) => void
|
|
}
|