Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MemCacheStore: always convert underlying values into an
Entry
There's a bug in the Mem Cache Store on 6.1, I haven't confirmed if it exists on `main` too (since #42025). We came across the bug when upgrading an app from 6.0 to 6.1 that had recently switched from the `dalli_store` to the `mem_cache_store`. petergoldstein/dalli#771 seems similar, but in our case it's specifically to do with caching the value `false`. To replicate: - Open a Rails console with the `dalli_store` enabled. - `Rails.cache.write "test", false` - Open another Rails console, with the `mem_cache_store` enabled. - Enable the local cache (starting a Rails server would also achieve this): `ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry.set_cache_for(Rails.cache.send(:local_cache_key), ActiveSupport::Cache::Strategy::LocalCache::LocalStore.new)` - ` Rails.cache.fetch("test") { false }` It will crash with `NoMethodError (undefined method `dup_value!' for false:FalseClass)`. The fix is to convert any entry into an `Entry`, even if it's `nil` or `false`.
- Loading branch information