0

I'm upgrading a legacy rails app from 5.2 to 6.1 and it looks like there were some changes to the config for cache_store and I'm now getting ERROR -- : undefined method 'reset' for #<ActiveSupport::Cache::MemCacheStore:0x000000010cbd9a90... when I try to spin up the server in staging and/or production. (Locally running :file_store)

before:

  memcache_servers = ENV['MEMCACHE_SERVERS'].to_s.split(/, */)
  config.cache_store = :dalli_store, *memcache_servers, {socket_timeout: 3} 

now:

  config.cache_store = :mem_cache_store

I've found this update in multiple places, more recently here but I've been flailing and searching for a while and can't find the actual docs I had found earlier that says rail's mem_cache_store actually uses dalli now and that the above change defaults to ENV['MEMCACHE_SERVERS'] for it's servers.

I'm not sure where to go from here. I've been deploying these changes for a couple of days now and getting the same error with each small tweak and running this locally under production environment is giving me the same thing.

Any help would be appreciated, thanks.

Sparkmasterflex
  • 1,837
  • 1
  • 20
  • 33
  • You need to figure out where `reset` is called from. Either change log level in staging to debug or use memcache locally – Mike Szyndel Apr 19 '23 at 08:14
  • Ugh... the error handling was all but useless but you were right further down my unicorn config file I had `Rails.cache.reset` that was from 8 years ago to fix a unicorn / dalli issue. Removed that and things seem to be working now – Sparkmasterflex Apr 19 '23 at 23:57
  • I think it's Rails.cache.clear now, in case you still need it – Mike Szyndel Apr 20 '23 at 07:44

0 Answers0