12345678910111213141516171819202122232425262728293031323334 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.InMemoryCacheAdapter = void 0;
- var _LRUCache = require("./LRUCache");
- class InMemoryCacheAdapter {
- constructor(ctx) {
- this.cache = new _LRUCache.LRUCache(ctx);
- }
- get(key) {
- const record = this.cache.get(key);
- if (record === null) {
- return Promise.resolve(null);
- }
- return Promise.resolve(record);
- }
- put(key, value, ttl) {
- this.cache.put(key, value, ttl);
- return Promise.resolve();
- }
- del(key) {
- this.cache.del(key);
- return Promise.resolve();
- }
- clear() {
- this.cache.clear();
- return Promise.resolve();
- }
- }
- exports.InMemoryCacheAdapter = InMemoryCacheAdapter;
- var _default = exports.default = InMemoryCacheAdapter;
|