This repository has been archived on 2023-08-31. You can view files and clone it, but cannot push or open issues or pull requests.
relay-plugin-registry/src/storage/backends/memory.ts

16 lines
516 B
TypeScript

import { SignedRegistryEntry, RegistryStorage } from "../../types.js";
import NodeCache from "node-cache";
export default class Memory implements RegistryStorage {
private _storage = new NodeCache();
async get(key: string): Promise<boolean | SignedRegistryEntry> {
const ret = await this._storage.get<SignedRegistryEntry>(key);
return ret ?? false;
}
async set(key: string, value: SignedRegistryEntry): Promise<boolean> {
return await this._storage.set<SignedRegistryEntry>(key, value);
}
}