Switch caching to Caffeine #2528
Merged
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.
For the past 4 years, we've been using ehcache as the caching layer, but I believe the configuration was incorrect.
We had a block
Which doesn't match any of the cache properties in the docs that I can see...
Then we also had
Where
micronaut.caches.member-cache.heap.max-entriesis supposed to be in theehcachenamespace...And
micronaut.caches.member-cache.expire-after-writeis a caffeine cache configuration entry, with no analog in ehcache (and it is also expecting a Duration).In an effort to fix this, I have arbitrarially decided to switch across to use
caffeinein place ofehcache, so the consolodated config now looks like:The ehcache
heap.max-entriesI have just converted tomaximum-sizefor the caffeine configI extracted a further class out of the service to actually fetch the image from Google so we can test that the caching is working more easily with Mocks (mocking the service threw away the cache annotations)