You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using CAS to fill a cache entry, we want to read from the local cache to try to get a cache hit without going to the remote cache. With #66 the local cache is updated at the end of the CAS methods, but it isn't used for reading, which does make sense in other cases where we want to make sure the remote cache entry is updated to the correct value. We also can't seamlessly add local cache reading to the CAS methods, since the given block is also used to compute the updated value which can be expensive when involving database loads where we only want to do that after first reading from the remote cache.
Currently, Active Support doesn't support getting the local cache to read from directly. I also can't think of a good reason to use that with the methods Active Support supports, since it doesn't support CAS operations.
Adding support for local cache reads would avoid this problem and given the application flexibility in how it handles the local cache value. Currently, I don't see a need to expose local cache writes so I think we could avoid exposing the local cache object or encouraging the application to manage the updating of the local cache directly.
The text was updated successfully, but these errors were encountered:
Although we could do a local cache read of the CAS token then do a remote CAS set, it could increase the chance of a cache conflict. Often the cache operation is the cheaper operation, so trying to save on a CAS get could increase the cache miss rate. Allowing a local cache read would provide more flexibility in what trade-offs are made so a local cache can be introduced without making performance worse.
cc @casperisfine
When using CAS to fill a cache entry, we want to read from the local cache to try to get a cache hit without going to the remote cache. With #66 the local cache is updated at the end of the CAS methods, but it isn't used for reading, which does make sense in other cases where we want to make sure the remote cache entry is updated to the correct value. We also can't seamlessly add local cache reading to the CAS methods, since the given block is also used to compute the updated value which can be expensive when involving database loads where we only want to do that after first reading from the remote cache.
Currently, Active Support doesn't support getting the local cache to read from directly. I also can't think of a good reason to use that with the methods Active Support supports, since it doesn't support CAS operations.
Adding support for local cache reads would avoid this problem and given the application flexibility in how it handles the local cache value. Currently, I don't see a need to expose local cache writes so I think we could avoid exposing the local cache object or encouraging the application to manage the updating of the local cache directly.
The text was updated successfully, but these errors were encountered: