39 lines
658 B
TypeScript
39 lines
658 B
TypeScript
/**
|
|
* {}
|
|
* @author yutent<yutent.io@gmail.com>
|
|
* @date 2025/01/03 10:39:13
|
|
*/
|
|
|
|
declare interface RedisConfig {
|
|
host: string
|
|
port: number
|
|
db: number
|
|
}
|
|
|
|
declare interface SessionConfig {
|
|
ttl?: number
|
|
domain?: string
|
|
level?: 0 | 2 | 4 | 6
|
|
secret: string
|
|
db: RedisConfig
|
|
}
|
|
|
|
declare class Store {
|
|
update(ssid: string): void
|
|
|
|
get(ssid: string, key?: string): Promise<string | object>
|
|
|
|
set(ssid: string, key: string, val: string): void
|
|
|
|
unset(ssid: string, key: string): void
|
|
|
|
clear(ssid: string): void
|
|
}
|
|
|
|
declare interface Session {
|
|
name: 'session'
|
|
install(conf?: SessionConfig): Store
|
|
}
|
|
|
|
export function createSession(): Session
|