Files
discord-decomp/_bundle/LRUMap.js
T
2026-11-01 12:12:55 +02:00

72 lines
1.5 KiB
JavaScript

// Metro module 993 (f994).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
let env816 = {};
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
const LRUMap = function LRUMap(a0) {
"use strict";
_classCallCheck(this, LRUMap);
this._maxSize = a0;
this._cache = new Map();
};
exports.LRUMap = __createClass(LRUMap, [{
key: "size",
get: function get() {
"use strict";
return this._cache.size;
}
}, {
key: "get",
value: function get(a0) {
"use strict";
const r6 = this._cache.get(a0);
if (r6 !== void 0) {
this._cache.delete(a0);
this._cache.set(a0, r6);
return r6;
}
}
}, {
key: "set",
value: function set(a0, a1) {
"use strict";
if (this._cache.size >= this._maxSize) {
this._cache.delete(this._cache.keys().next().value);
}
this._cache.set(a0, a1);
}
}, {
key: "remove",
value: function remove(a0) {
"use strict";
const r4 = this._cache.get(a0);
if (r4) {
this._cache.delete(a0);
}
return r4;
}
}, {
key: "clear",
value: function clear() {
"use strict";
this._cache.clear();
}
}, {
key: "keys",
value: function keys() {
"use strict";
return Array.from(this._cache.keys());
}
}, {
key: "values",
value: function values() {
"use strict";
const r0 = [];
let c23956_0 = r0;
this._cache.forEach((item) => c23956_0.push(item));
return r0;
}
}]);