• R/O
  • SSH

fcf-framework-core: Commit

Main functions and classes of the FCF framework


Commit MetaInfo

Révisionaa895244477f0e479e6249847528d936b8b389af (tree)
l'heure2022-12-05 11:40:09
Auteurvmarkin
Commitervmarkin

Message de Log

Added fcf.Cache

Change Summary

Modification

diff -r 48d17a9a6bcc -r aa895244477f fcf.js
--- a/fcf.js Mon Dec 05 05:24:25 2022 +0300
+++ b/fcf.js Mon Dec 05 05:40:09 2022 +0300
@@ -1907,7 +1907,6 @@
19071907 constructor(a_mcapacity){
19081908 this._mcapacity = !isNaN(a_mcapacity) && parseInt(a_mcapacity) > 0 ? a_mcapacity : 1000000;
19091909 this._cachem = new Map();
1910- this._cachev = [];
19111910 this._msize = 0;
19121911 }
19131912
@@ -1924,9 +1923,6 @@
19241923
19251924 set(a_key, a_value) {
19261925 a_key = a_key.toString();
1927- if (!(a_key in this._cachem)) {
1928- this._cachev.push(a_key);
1929- }
19301926 let rec = this._cachem.get(a_key);
19311927 if (rec)
19321928 this._msize -= rec.s;
@@ -1937,7 +1933,7 @@
19371933 }
19381934
19391935 getSize(){
1940- return this._cachev.length;
1936+ return this._cachem.size;
19411937 }
19421938
19431939 getMSize(){
@@ -1955,7 +1951,7 @@
19551951
19561952 _clear() {
19571953 while(this._msize > this._mcapacity) {
1958- let rkey = this._cachev.shift();
1954+ let rkey = this._cachem.entries().next().value[0];
19591955 let rec = this._cachem.get(rkey);
19601956 this._msize -= rec.s;
19611957 this._cachem.delete(rkey);
Afficher sur ancien navigateur de dépôt.