I am working on a use case where cache keys are stored based on a UUID of the document.
Each document which is JSON can have references to another documents , cache is created for those documents too.
If I have 3 documents , I have the cache as
Coming to references suppose the JSON for UUID_1 is as below
Now the thing is whenever UUID_2 gets modified , I want to invalidate both UUID_2 and UUID_1 as well (UUID_2 was internally referred inside UUID_1)
is there some way to maintain these references so that cache invalidation can be done.
Don’t want to add the referred documents with the cache key , because the reference array does not
have any size and cache key will grow indefinitely.
secondly , when the call comes , the referred documents won’t be passed , so a wildcard search has to be called to first get the actual key name and they perform the get for the key’s value.
Need to keep the get O(1) and also when cache invalidation occurs , a straight call to which ever documents have references , must be flushed.