Reputation: 1
I'm working on a system which receives key-value pairs and tracks the mappings seen in the last hour. For example the following sequence:
(A, 3) (C, 7) (C, 6) (B, 1), (B, 2), (A, 1), (C, 9)...
Would be tracked similar to the following:
A -> 1, 3
B -> 1, 2
C -> 6, 7, 9
The tracked values expire and are removed if they hadn't been re-received after a set time period.
The system allows callers to provide a single key and it returns all the tracked values (e.g. C returns 6, 7, 9). I'm expect 100s of thousands of keys to be tracked and need to handle 10s of thousands of values for the most popular keys. Will probably need to provide pagination to support keys with thousands of values. It is a concurrent system with updates and queries occurring in parallel.
I was looking at whether there was a way I could implement this using Caffeine cache. Has there been much prior experience/art in using Caffeine as a multimap? One of the complications that first comes to mind is that I want the values to expire independently of each other and their key. Is there any way to handle his in Caffeine, or I am going to need to manage this outside of the core Caffeine cache?
Upvotes: 0
Views: 120