chore: add metrics and tests to all cache implementations#2874
chore: add metrics and tests to all cache implementations#2874miparnisari merged 1 commit intomainfrom
Conversation
Codecov Report❌ Patch coverage is ❌ Your project status has failed because the head coverage (74.88%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2874 +/- ##
===========================================
+ Coverage 50.02% 74.88% +24.87%
===========================================
Files 416 484 +68
Lines 51735 57869 +6134
===========================================
+ Hits 25873 43328 +17455
+ Misses 23288 11506 -11782
- Partials 2574 3035 +461 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f0c44c8 to
07633a8
Compare
There was a problem hiding this comment.
FYI this is the one used in prod today
tstirrat15
left a comment
There was a problem hiding this comment.
LGTM, but see question about otter
| } | ||
|
|
||
| cache := wrapped[K, V]{name, config, config.DefaultTTL, rcache} | ||
| cache := ristretoCache[K, V]{name, config, config.DefaultTTL, rcache} |
There was a problem hiding this comment.
| cache := ristretoCache[K, V]{name, config, config.DefaultTTL, rcache} | |
| cache := ristrettoCache[K, V]{name, config, config.DefaultTTL, rcache} |
Plus other updates
There was a problem hiding this comment.
follow-up PR :D
| } | ||
|
|
||
| wtc.metrics.costAdded.Add(uint64(uintCost)) | ||
| _, ok := wtc.Get(key) |
There was a problem hiding this comment.
I wonder if there's a meaningful difference between Otter and Ristretto such that this bookkeeping isn't required?
There was a problem hiding this comment.
More generally i think the semantics of this entire Cache interface are unclear. What is Set supposed to return if the key exists?
Theine overwrites.
Otter fails if it already exists.
Ristretto overwrites, i think.
I don't know how the callers expect Set to behave to say how each impl should behave.
07633a8 to
c02161f
Compare
c02161f to
0393250
Compare
No description provided.