@foal/mongodb
Version:
MongoDB package for FoalTS session
28 lines (27 loc) • 853 B
TypeScript
import { SessionState, SessionStore } from '@foal/core';
import { MongoClient } from 'mongodb';
/**
* MongoDB store.
*
* @export
* @class MongoDBStore
* @extends {SessionStore}
*/
export declare class MongoDBStore extends SessionStore {
private mongoDBClient;
private collection;
setMongoDBClient(mongoDBClient: MongoClient): void;
boot(): Promise<void>;
save(state: SessionState, maxInactivity: number): Promise<void>;
read(id: string): Promise<SessionState | null>;
update(state: SessionState, maxInactivity: number): Promise<void>;
destroy(id: string): Promise<void>;
clear(): Promise<void>;
cleanUpExpiredSessions(maxInactivity: number, maxLifeTime: number): Promise<void>;
/**
* Closes the connection to the database.
*
* @memberof MongoDBStore
*/
close(): Promise<void>;
}