ff-operation-server/src/storage/missionMap.ts

28 lines
753 B
TypeScript
Raw Normal View History

2025-02-21 11:55:34 +01:00
export interface missionStoreModel {
missionId: string;
doc: any;
}
/**
* @description store credentials to socket to prevent auth data change while connected
*/
export abstract class MissionMap {
private static store = new Map<string, missionStoreModel>();
public static write(identifier: string, data: missionStoreModel, overwrite: boolean = false): void {
if (!this.exists(identifier) || overwrite) this.store.set(identifier, data);
}
public static read(identifier: string): missionStoreModel {
return this.store.get(identifier);
}
public static exists(identifier: string): boolean {
return this.store.has(identifier);
}
public static delete(identifier: string): void {
this.store.delete(identifier);
}
}