Hi, I notice ActiveSupport::Cache implementations behave differently when cache key is nil.
cache_key = nil
Rails.cache.write(cache_key, 'value')
Rails.cache.read(cache_key)
For example, FileStore raises a file system error “No such file or directory” when calling write()
with nil cache key. This error does not communicate what actually went wrong (i.e. cache key cannot be nil/empty). It’s better if a descriptive exception is raised.
Anyway, I’m curious what should be the expected behavior when cache key is nil? And whether the expected behavior should be specified in ActiveSupport::Cache or in its implementation?
fyi, more details and failing tests are available: https://github.com/rails/rails/pull/11009