Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an eviction callback, which if set is called for each element that leaves the cache. This is useful if your cached values contain some resource that you want to recover. PR #1 had the same idea but is very much out of date with respect to the code.
Unfortunately this functionality doesn't come entirely for free, even if no callback is set. In terms of
test/benchmark.jl
the timing differences seem to be within the measurement noise but what is definitely noticeable is that all functions that may cause eviction (setindex!
,get!
,pop!
,delete!
,resize!
,empty!
) get one extra allocation of 80 bytes to hold the empty list of pending evictions.To avoid this allocation will either require: