decord/source/13209_LRUCache.js

63 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13209
// Function ID: 13210
2026-07-20 16:05:17 +00:00
// Name: LRUCache
2026-07-29 08:29:29 +00:00
// Dependencies: [41, 42]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 13209 (LRUCache)
import _createClass from "_createClass" /* 42 */;
import LRUCache from "_classCallCheck" /* 41 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
class LRUCache {
constructor() {
tmp = LRUCache(this, LRUCache);
this.max = 1000;
map = new Map();
this.map = map;
return;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
const items = [
{
2026-07-20 16:05:17 +00:00
key: "get",
value: function get(arg0) {
const self = this;
const value = this.map.get(arg0);
let tmp2;
if (undefined !== value) {
self.map.delete(arg0);
const result = self.map.set(arg0, value);
tmp2 = value;
const map2 = self.map;
const map3 = self.map;
}
return tmp2;
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "delete",
value: function _delete(arg0) {
return this.map.delete(arg0);
}
2026-07-29 08:29:29 +00:00
},
{
2026-07-20 16:05:17 +00:00
key: "set",
value: function set(arg0, arg1) {
const self = this;
if (!this.delete(arg0)) {
if (undefined !== arg1) {
if (self.map.size >= self.max) {
self.delete(self.map.keys().next().value);
const iter = self.map.keys();
const map = self.map;
}
const result = self.map.set(arg0, arg1);
const map2 = self.map;
}
}
return self;
}
2026-07-29 08:29:29 +00:00
}
];
export default _createClass(LRUCache, items);