rails--rails/activesupport/test/cache
Nate Pinsky fd8c36707f Support aliases to expires_in for cache stores
The `expires_in` option is easy to misremember or mistype as `expire_in`
or `expired_in`, with potentially harmful results. If a developer wants
to cache a value for only 2 seconds but mistakenly types
`expire_in: 2.seconds`, that value will instead be cached for the
default time, likely 6 hours, meaning that users of the site will see
the same data for much longer than they should, and the only recovery
(short of waiting for the 6 hours to elapse) is to manually expire all
relevant keys. This commit allows cache stores to recognize these common
typos as aliases by normalizing them before consuming the options.

In general, we should be careful about adding too many aliases for
options to the cache stores, since each option key used by the base
Cache::Store class is one fewer key that each cache implementation can
customize for itself. This case was approved because of the similarity
of the aliases to the root key and the potential damage caused by
mistaking them.

Fixes #39850.
2020-12-28 17:15:43 -08:00
..
behaviors Support aliases to expires_in for cache stores 2020-12-28 17:15:43 -08:00
stores consume dalli's cache_nils configuration as ActiveSupport::Cache's skip_nil when using MemCacheStore. 2020-12-18 13:10:33 +05:30
behaviors.rb Make AS::Cache coder configurable 2020-10-14 12:12:36 +02:00
cache_entry_test.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00
cache_key_test.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00
cache_store_logger_test.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00
cache_store_namespace_test.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00
cache_store_setting_test.rb Restore the `lookup_store` compatibility to accept config as a single object 2020-03-25 06:05:57 +09:00
local_cache_middleware_test.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00