You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
898 B
40 lines
898 B
import Session from './Session.ts'
|
|
import SessionInterface, { SessionData } from './SessionInterface.ts'
|
|
|
|
/**
|
|
* Basic session implementation that exists only in memory.
|
|
* @extends Session
|
|
* @implements SessionInterface
|
|
*/
|
|
export default class MemorySession extends Session implements SessionInterface {
|
|
private _key!: string
|
|
private _data: SessionData = {}
|
|
|
|
public get_key(): string {
|
|
return this._key
|
|
}
|
|
|
|
public set_key(key: string) {
|
|
this._key = key
|
|
}
|
|
|
|
public get_data(): SessionData {
|
|
return this._data
|
|
}
|
|
|
|
public set_data(data: SessionData) {
|
|
this._data = data
|
|
}
|
|
|
|
public get_attribute(key: string): any {
|
|
return this._data[key]
|
|
}
|
|
|
|
public set_attribute(key: string, value: any) {
|
|
this._data[key] = value
|
|
}
|
|
|
|
public async persist() {}
|
|
public async init_session(): Promise<void> {}
|
|
}
|