Open
Description
The serialization extension assumes that currentsize
is always measured by the number of items in the LRU.
If we use another by
function to measure size, then we error trying to serialize
(which is good because it looks like deserialize
depends on this assumption).
using LRUCache
using Serialization
lru = LRU{String,Vector{UInt8}}(; maxsize = 1024, by = sizeof)
lru["asdf"] = rand(UInt8, 512)
# not the same
@assert lru.currentsize == 512
@assert length(lru) == 1
serialize(IOBuffer(), lru)
# ERROR: AssertionError: lru.currentsize == length(lru)
Would a PR contribution be welcome to help here?
Metadata
Metadata
Assignees
Labels
No labels
Activity