Closed drgrice1 closed 4 months ago
How exactly does the maxSize
depend on the sizeCalculation
setting? That is not clearly stated in the documentation. That may be the answer instead of a fixed unit.
The definition of "size" is up to you. As far as this library is concerned, it's just a number that the sizeCalculation
returns for some key/value pair. That could be bits, bytes, or bananas.
You can also specify the size in the set()
options, if you want to state it at that point, instead of in a method that calculates it.
But "what it means" is up to you. You decide.
Hi, how is the total size calculated? When is the
sizeCalculation
called? Is it called only at the insertion or called periodically for all items?
Only on insert / remove, no periodic check.
The size of items may change.
Put the item into the cache with the same key and new size.
Your documentation states that setting
maxSize
will limit the overall storage size, but it does not clarify what the unit of the number for that size is. Is it bits, bytes, kilobytes, megabytes, etc? Presumably it is bytes, but that is not stated, leaving it quite unclear what numerical setting is needed to obtain the desirable limit.