Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
32 lines
753 B
Plaintext
32 lines
753 B
Plaintext
/* eslint-disable @typescript-eslint/require-await */ export class InMemoryKVAdapter {
|
|
store = new Map();
|
|
async clear() {
|
|
this.store.clear();
|
|
}
|
|
async delete(key) {
|
|
this.store.delete(key);
|
|
}
|
|
async get(key) {
|
|
const value = this.store.get(key);
|
|
if (typeof value === 'undefined') {
|
|
return null;
|
|
}
|
|
return value;
|
|
}
|
|
async has(key) {
|
|
return this.store.has(key);
|
|
}
|
|
async keys() {
|
|
return Array.from(this.store.keys());
|
|
}
|
|
async set(key, value) {
|
|
this.store.set(key, value);
|
|
}
|
|
}
|
|
export const inMemoryKVAdapter = ()=>{
|
|
return {
|
|
init: ()=>new InMemoryKVAdapter()
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=InMemoryKVAdapter.js.map |