api: make deepsource happy

This commit is contained in:
jj
2024-11-01 17:24:22 +00:00
parent 90d57ab6ea
commit 5a66af514e
4 changed files with 21 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ export class Store {
this.id = name;
}
async _has(_key) { throw "needs implementation" }
async _has(_key) { await Promise.reject("needs implementation"); }
has(key) {
if (typeof key !== 'string') {
key = key.toString();
@@ -22,7 +22,7 @@ export class Store {
return this._has(key);
}
async _get(_key) { throw "needs implementation" }
async _get(_key) { await Promise.reject("needs implementation"); }
async get(key) {
if (typeof key !== 'string') {
key = key.toString();
@@ -35,7 +35,7 @@ export class Store {
return val;
}
async _set(_key, _val, _exp_sec = -1) { throw "needs implementation" }
async _set(_key, _val, _exp_sec = -1) { await Promise.reject("needs implementation") }
set(key, val, exp_sec = -1) {
if (typeof key !== 'string') {
key = key.toString();

View File

@@ -14,17 +14,17 @@ export default class MemoryStore extends Store {
super(name);
}
async _has(key) {
_has(key) {
return this.#store.has(key);
}
async _get(key) {
_get(key) {
const val = this.#store.get(key);
return val === undefined ? null : val;
}
async _set(key, val, exp_sec = -1) {
_set(key, val, exp_sec = -1) {
if (this.#store.has(key)) {
this.#timeouts.remove(o => o.k === key);
}