mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-05 19:40:09 +00:00
perf: SimpleDataStore
This commit is contained in:
parent
8a1ff434d9
commit
39aaa25f3f
@ -52,14 +52,14 @@ class SimpleDataStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getStalest () {
|
getStalest () {
|
||||||
let stalest = null
|
let stalest = [null, { stratval: Infinity }]
|
||||||
switch (this.#strategy) {
|
switch (this.#strategy) {
|
||||||
// both "lastGetTime" and "getsCount" simply must find lowest value
|
// both "lastGetTime" and "getsCount" simply must find lowest value
|
||||||
// to determine the stalest entry
|
// to determine the stalest entry
|
||||||
case STRATEGIES[0]:
|
case STRATEGIES[0]:
|
||||||
case STRATEGIES[1]:
|
case STRATEGIES[1]:
|
||||||
for (const entry of this.#store) {
|
for (const entry of this.#store) {
|
||||||
if (!stalest || entry[1].stratval < stalest[1].stratval) {
|
if (entry[1].stratval < stalest[1].stratval) {
|
||||||
stalest = entry
|
stalest = entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user