1.4 KiB
1.4 KiB
InMemory Sessions
A Service to store Sessions in Memory.
Install
npm i --save @apihub24/in-memory-sessions
Dependencies
| Exported Injection Keys |
|---|
| @apihub24/session_service |
Usage
// NestJs usage
import { InMemorySessionsModule } from "@apihub24/in-memory-sessions";
@Module({
imports: [InMemorySessionsModule.forRoot()]
})
...
// Other usage
import { InMemorySessionsModule } from "@apihub24/in-memory-sessions";
const sessionService = new InMemorySessionService();
| Function | Description |
|---|---|
| create(account: IAccount): Promise | Create a new Session from a IAccount and returns it |
| getBy(filter: (account: IAccount) => boolean): Promise<ISession[]> | get a ISession by a IAccount filter |
| getById(sessionId: string): Promise | get a ISession by a session id. the returned ISession can be null if not exists |
| remove(sessionId: string): Promise | remove the ISession by a session id. |