Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/oblivious-set/dist/es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /**
* this is a set which automatically forgets
* a given entry when a new entry is set and the ttl
* of the old one is over
*/
var ObliviousSet = /** @class */ (function () {
function ObliviousSet(ttl) {
this.ttl = ttl;
this.set = new Set();
this.timeMap = new Map();
}
ObliviousSet.prototype.has = function (value) {
return this.set.has(value);
};
ObliviousSet.prototype.add = function (value) {
var _this = this;
this.timeMap.set(value, now());
this.set.add(value);
/**
* When a new value is added,
* start the cleanup at the next tick
* to not block the cpu for more important stuff
* that might happen.
*/
setTimeout(function () {
removeTooOldValues(_this);
}, 0);
};
ObliviousSet.prototype.clear = function () {
this.set.clear();
this.timeMap.clear();
};
return ObliviousSet;
}());
export { ObliviousSet };
/**
* Removes all entries from the set
* where the TTL has expired
*/
export function removeTooOldValues(obliviousSet) {
var olderThen = now() - obliviousSet.ttl;
var iterator = obliviousSet.set[Symbol.iterator]();
/**
* Because we can assume the new values are added at the bottom,
* we start from the top and stop as soon as we reach a non-too-old value.
*/
while (true) {
var value = iterator.next().value;
if (!value) {
return; // no more elements
}
var time = obliviousSet.timeMap.get(value);
if (time < olderThen) {
obliviousSet.timeMap.delete(value);
obliviousSet.set.delete(value);
}
else {
// We reached a value that is not old enough
return;
}
}
}
export function now() {
return new Date().getTime();
}
//# sourceMappingURL=index.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0381 ]-- |