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

69 lines
1.4 KiB
JavaScript

// Metro module 6487 (f6488).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
let env4184 = {};
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 c25894_0 = r0;
this._cache.forEach((item) => c25894_0.push(item));
return r0;
}
}]);