streamline
streamline copied to clipboard
Revisit GuavaCache to not load entries automatically
Streamline GuavaCache impl uses a Loading cache, but Storable may or may not be cacheable. So need to revisit and make sure GuavaCache caches only if Storable.isCacheable
is true.
After these changes CacheBackedStorageManager.get
should be refactored.
Lets remove Caching from storage as we really don't need it. We can keep the caching details around custom processor.
@harshach , isn't it good to have the caching layer in-front of the Db so that we don't hit the db always?
In H/A usage we should get rid of caching layer in front of DB, given that changing entity is not broadcasted to all nodes.
So we can't avoid hitting DB unless we maintain central cache. If we still need to cache due to some huge entities, we can maintain cache and query twice, comparing timestamp to check cached data is valid, and query entity if it's invalid for now.
In HA we need to use a distb cache or use a local cache with some reasonable timeout. If version mismatches occur during updates, we can discard the cached value reload the value from DB and retry.
We may need to also consider reading. Maybe some entities are not eligible to be cached even with timeout (entities which can be modified concurrently). If we go with timeout, we need to decide which are safe to be cached (ideally along with duration) and which are not. So fine-grained control is required.