Initial Sample.

This commit is contained in:
2024-06-03 20:23:50 +05:30
parent ef2b65f673
commit 5269ec3c66
2575 changed files with 282312 additions and 0 deletions

View File

@@ -0,0 +1,245 @@
'use strict';
function defaultDispose$1() { }
var StrongCache = /** @class */ (function () {
function StrongCache(max, dispose) {
if (max === void 0) { max = Infinity; }
if (dispose === void 0) { dispose = defaultDispose$1; }
this.max = max;
this.dispose = dispose;
this.map = new Map();
this.newest = null;
this.oldest = null;
}
StrongCache.prototype.has = function (key) {
return this.map.has(key);
};
StrongCache.prototype.get = function (key) {
var node = this.getNode(key);
return node && node.value;
};
Object.defineProperty(StrongCache.prototype, "size", {
get: function () {
return this.map.size;
},
enumerable: false,
configurable: true
});
StrongCache.prototype.getNode = function (key) {
var node = this.map.get(key);
if (node && node !== this.newest) {
var older = node.older, newer = node.newer;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
};
StrongCache.prototype.set = function (key, value) {
var node = this.getNode(key);
if (node) {
return node.value = value;
}
node = {
key: key,
value: value,
newer: null,
older: this.newest
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.map.set(key, node);
return node.value;
};
StrongCache.prototype.clean = function () {
while (this.oldest && this.map.size > this.max) {
this.delete(this.oldest.key);
}
};
StrongCache.prototype.delete = function (key) {
var node = this.map.get(key);
if (node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.map.delete(key);
this.dispose(node.value, key);
return true;
}
return false;
};
return StrongCache;
}());
function noop() { }
var defaultDispose = noop;
var _WeakRef = typeof WeakRef !== "undefined"
? WeakRef
: function (value) {
return { deref: function () { return value; } };
};
var _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map;
var _FinalizationRegistry = typeof FinalizationRegistry !== "undefined"
? FinalizationRegistry
: function () {
return {
register: noop,
unregister: noop,
};
};
var finalizationBatchSize = 10024;
var WeakCache = /** @class */ (function () {
function WeakCache(max, dispose) {
if (max === void 0) { max = Infinity; }
if (dispose === void 0) { dispose = defaultDispose; }
var _this = this;
this.max = max;
this.dispose = dispose;
this.map = new _WeakMap();
this.newest = null;
this.oldest = null;
this.unfinalizedNodes = new Set();
this.finalizationScheduled = false;
this.size = 0;
this.finalize = function () {
var iterator = _this.unfinalizedNodes.values();
for (var i = 0; i < finalizationBatchSize; i++) {
var node = iterator.next().value;
if (!node)
break;
_this.unfinalizedNodes.delete(node);
var key = node.key;
delete node.key;
node.keyRef = new _WeakRef(key);
_this.registry.register(key, node, node);
}
if (_this.unfinalizedNodes.size > 0) {
queueMicrotask(_this.finalize);
}
else {
_this.finalizationScheduled = false;
}
};
this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));
}
WeakCache.prototype.has = function (key) {
return this.map.has(key);
};
WeakCache.prototype.get = function (key) {
var node = this.getNode(key);
return node && node.value;
};
WeakCache.prototype.getNode = function (key) {
var node = this.map.get(key);
if (node && node !== this.newest) {
var older = node.older, newer = node.newer;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
};
WeakCache.prototype.set = function (key, value) {
var node = this.getNode(key);
if (node) {
return (node.value = value);
}
node = {
key: key,
value: value,
newer: null,
older: this.newest,
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.scheduleFinalization(node);
this.map.set(key, node);
this.size++;
return node.value;
};
WeakCache.prototype.clean = function () {
while (this.oldest && this.size > this.max) {
this.deleteNode(this.oldest);
}
};
WeakCache.prototype.deleteNode = function (node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.size--;
var key = node.key || (node.keyRef && node.keyRef.deref());
this.dispose(node.value, key);
if (!node.keyRef) {
this.unfinalizedNodes.delete(node);
}
else {
this.registry.unregister(node);
}
if (key)
this.map.delete(key);
};
WeakCache.prototype.delete = function (key) {
var node = this.map.get(key);
if (node) {
this.deleteNode(node);
return true;
}
return false;
};
WeakCache.prototype.scheduleFinalization = function (node) {
this.unfinalizedNodes.add(node);
if (!this.finalizationScheduled) {
this.finalizationScheduled = true;
queueMicrotask(this.finalize);
}
};
return WeakCache;
}());
exports.StrongCache = StrongCache;
exports.WeakCache = WeakCache;
//# sourceMappingURL=bundle.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,245 @@
'use strict';
function defaultDispose$1() { }
var StrongCache = /** @class */ (function () {
function StrongCache(max, dispose) {
if (max === void 0) { max = Infinity; }
if (dispose === void 0) { dispose = defaultDispose$1; }
this.max = max;
this.dispose = dispose;
this.map = new Map();
this.newest = null;
this.oldest = null;
}
StrongCache.prototype.has = function (key) {
return this.map.has(key);
};
StrongCache.prototype.get = function (key) {
var node = this.getNode(key);
return node && node.value;
};
Object.defineProperty(StrongCache.prototype, "size", {
get: function () {
return this.map.size;
},
enumerable: false,
configurable: true
});
StrongCache.prototype.getNode = function (key) {
var node = this.map.get(key);
if (node && node !== this.newest) {
var older = node.older, newer = node.newer;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
};
StrongCache.prototype.set = function (key, value) {
var node = this.getNode(key);
if (node) {
return node.value = value;
}
node = {
key: key,
value: value,
newer: null,
older: this.newest
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.map.set(key, node);
return node.value;
};
StrongCache.prototype.clean = function () {
while (this.oldest && this.map.size > this.max) {
this.delete(this.oldest.key);
}
};
StrongCache.prototype.delete = function (key) {
var node = this.map.get(key);
if (node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.map.delete(key);
this.dispose(node.value, key);
return true;
}
return false;
};
return StrongCache;
}());
function noop() { }
var defaultDispose = noop;
var _WeakRef = typeof WeakRef !== "undefined"
? WeakRef
: function (value) {
return { deref: function () { return value; } };
};
var _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map;
var _FinalizationRegistry = typeof FinalizationRegistry !== "undefined"
? FinalizationRegistry
: function () {
return {
register: noop,
unregister: noop,
};
};
var finalizationBatchSize = 10024;
var WeakCache = /** @class */ (function () {
function WeakCache(max, dispose) {
if (max === void 0) { max = Infinity; }
if (dispose === void 0) { dispose = defaultDispose; }
var _this = this;
this.max = max;
this.dispose = dispose;
this.map = new _WeakMap();
this.newest = null;
this.oldest = null;
this.unfinalizedNodes = new Set();
this.finalizationScheduled = false;
this.size = 0;
this.finalize = function () {
var iterator = _this.unfinalizedNodes.values();
for (var i = 0; i < finalizationBatchSize; i++) {
var node = iterator.next().value;
if (!node)
break;
_this.unfinalizedNodes.delete(node);
var key = node.key;
delete node.key;
node.keyRef = new _WeakRef(key);
_this.registry.register(key, node, node);
}
if (_this.unfinalizedNodes.size > 0) {
queueMicrotask(_this.finalize);
}
else {
_this.finalizationScheduled = false;
}
};
this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));
}
WeakCache.prototype.has = function (key) {
return this.map.has(key);
};
WeakCache.prototype.get = function (key) {
var node = this.getNode(key);
return node && node.value;
};
WeakCache.prototype.getNode = function (key) {
var node = this.map.get(key);
if (node && node !== this.newest) {
var older = node.older, newer = node.newer;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
};
WeakCache.prototype.set = function (key, value) {
var node = this.getNode(key);
if (node) {
return (node.value = value);
}
node = {
key: key,
value: value,
newer: null,
older: this.newest,
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.scheduleFinalization(node);
this.map.set(key, node);
this.size++;
return node.value;
};
WeakCache.prototype.clean = function () {
while (this.oldest && this.size > this.max) {
this.deleteNode(this.oldest);
}
};
WeakCache.prototype.deleteNode = function (node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.size--;
var key = node.key || (node.keyRef && node.keyRef.deref());
this.dispose(node.value, key);
if (!node.keyRef) {
this.unfinalizedNodes.delete(node);
}
else {
this.registry.unregister(node);
}
if (key)
this.map.delete(key);
};
WeakCache.prototype.delete = function (key) {
var node = this.map.get(key);
if (node) {
this.deleteNode(node);
return true;
}
return false;
};
WeakCache.prototype.scheduleFinalization = function (node) {
this.unfinalizedNodes.add(node);
if (!this.finalizationScheduled) {
this.finalizationScheduled = true;
queueMicrotask(this.finalize);
}
};
return WeakCache;
}());
exports.StrongCache = StrongCache;
exports.WeakCache = WeakCache;
//# sourceMappingURL=bundle.cjs.map

View File

@@ -0,0 +1,8 @@
export interface CommonCache<K, V> {
has(key: K): boolean;
get(key: K): V | undefined;
set(key: K, value: V): V;
delete(key: K): boolean;
clean(): void;
readonly size: number;
}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=common.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,3 @@
export type { CommonCache } from "./common.js";
export { StrongCache } from "./strong.js";
export { WeakCache } from "./weak.js";

View File

@@ -0,0 +1,3 @@
export { StrongCache } from "./strong.js";
export { WeakCache } from "./weak.js";
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}

View File

@@ -0,0 +1,16 @@
import type { CommonCache } from "./common";
export declare class StrongCache<K = any, V = any> implements CommonCache<K, V> {
private max;
dispose: (value: V, key: K) => void;
private map;
private newest;
private oldest;
constructor(max?: number, dispose?: (value: V, key: K) => void);
has(key: K): boolean;
get(key: K): V | undefined;
get size(): number;
private getNode;
set(key: K, value: V): V;
clean(): void;
delete(key: K): boolean;
}

View File

@@ -0,0 +1,86 @@
function defaultDispose() { }
export class StrongCache {
constructor(max = Infinity, dispose = defaultDispose) {
this.max = max;
this.dispose = dispose;
this.map = new Map();
this.newest = null;
this.oldest = null;
}
has(key) {
return this.map.has(key);
}
get(key) {
const node = this.getNode(key);
return node && node.value;
}
get size() {
return this.map.size;
}
getNode(key) {
const node = this.map.get(key);
if (node && node !== this.newest) {
const { older, newer } = node;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
}
set(key, value) {
let node = this.getNode(key);
if (node) {
return node.value = value;
}
node = {
key,
value,
newer: null,
older: this.newest
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.map.set(key, node);
return node.value;
}
clean() {
while (this.oldest && this.map.size > this.max) {
this.delete(this.oldest.key);
}
}
delete(key) {
const node = this.map.get(key);
if (node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.map.delete(key);
this.dispose(node.value, key);
return true;
}
return false;
}
}
//# sourceMappingURL=strong.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strong.js","sourceRoot":"","sources":["../src/strong.ts"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K,CAAC;aAC1B;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC/B;YAED,IAAI,IAAI,CAAC,KAAK,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC/B;YAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAE9B,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}

View File

@@ -0,0 +1,22 @@
import type { CommonCache } from "./common";
export declare class WeakCache<K extends object = any, V = any> implements CommonCache<K, V> {
private max;
dispose: (value: V, key?: K) => void;
private map;
private registry;
private newest;
private oldest;
private unfinalizedNodes;
private finalizationScheduled;
size: number;
constructor(max?: number, dispose?: (value: V, key?: K) => void);
has(key: K): boolean;
get(key: K): V | undefined;
private getNode;
set(key: K, value: V): V;
clean(): void;
private deleteNode;
delete(key: K): boolean;
private scheduleFinalization;
private finalize;
}

View File

@@ -0,0 +1,143 @@
function noop() { }
const defaultDispose = noop;
const _WeakRef = typeof WeakRef !== "undefined"
? WeakRef
: function (value) {
return { deref: () => value };
};
const _WeakMap = typeof WeakMap !== "undefined" ? WeakMap : Map;
const _FinalizationRegistry = typeof FinalizationRegistry !== "undefined"
? FinalizationRegistry
: function () {
return {
register: noop,
unregister: noop,
};
};
const finalizationBatchSize = 10024;
export class WeakCache {
constructor(max = Infinity, dispose = defaultDispose) {
this.max = max;
this.dispose = dispose;
this.map = new _WeakMap();
this.newest = null;
this.oldest = null;
this.unfinalizedNodes = new Set();
this.finalizationScheduled = false;
this.size = 0;
this.finalize = () => {
const iterator = this.unfinalizedNodes.values();
for (let i = 0; i < finalizationBatchSize; i++) {
const node = iterator.next().value;
if (!node)
break;
this.unfinalizedNodes.delete(node);
const key = node.key;
delete node.key;
node.keyRef = new _WeakRef(key);
this.registry.register(key, node, node);
}
if (this.unfinalizedNodes.size > 0) {
queueMicrotask(this.finalize);
}
else {
this.finalizationScheduled = false;
}
};
this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));
}
has(key) {
return this.map.has(key);
}
get(key) {
const node = this.getNode(key);
return node && node.value;
}
getNode(key) {
const node = this.map.get(key);
if (node && node !== this.newest) {
const { older, newer } = node;
if (newer) {
newer.older = older;
}
if (older) {
older.newer = newer;
}
node.older = this.newest;
node.older.newer = node;
node.newer = null;
this.newest = node;
if (node === this.oldest) {
this.oldest = newer;
}
}
return node;
}
set(key, value) {
let node = this.getNode(key);
if (node) {
return (node.value = value);
}
node = {
key,
value,
newer: null,
older: this.newest,
};
if (this.newest) {
this.newest.newer = node;
}
this.newest = node;
this.oldest = this.oldest || node;
this.scheduleFinalization(node);
this.map.set(key, node);
this.size++;
return node.value;
}
clean() {
while (this.oldest && this.size > this.max) {
this.deleteNode(this.oldest);
}
}
deleteNode(node) {
if (node === this.newest) {
this.newest = node.older;
}
if (node === this.oldest) {
this.oldest = node.newer;
}
if (node.newer) {
node.newer.older = node.older;
}
if (node.older) {
node.older.newer = node.newer;
}
this.size--;
const key = node.key || (node.keyRef && node.keyRef.deref());
this.dispose(node.value, key);
if (!node.keyRef) {
this.unfinalizedNodes.delete(node);
}
else {
this.registry.unregister(node);
}
if (key)
this.map.delete(key);
}
delete(key) {
const node = this.map.get(key);
if (node) {
this.deleteNode(node);
return true;
}
return false;
}
scheduleFinalization(node) {
this.unfinalizedNodes.add(node);
if (!this.finalizationScheduled) {
this.finalizationScheduled = true;
queueMicrotask(this.finalize);
}
}
}
//# sourceMappingURL=weak.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"weak.js","sourceRoot":"","sources":["../src/weak.ts"],"names":[],"mappings":"AAoBA,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,cAAc,GAAG,IAAI,CAAC;A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