1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/cache/behaviors
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
..
autoloading_cache_behavior.rb allow running each test with pure ruby path/to/test.rb 2019-12-18 08:49:19 -06:00
cache_delete_matched_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
cache_increment_decrement_behavior.rb activesupport: Avoid Marshal.load on raw cache value in RedisCacheStore 2020-05-15 15:38:33 -07:00
cache_instrumentation_behavior.rb Instrument cache store name 2020-10-21 22:44:14 +01:00
cache_store_behavior.rb Support aliases to expires_in for cache stores 2020-12-28 17:15:43 -08:00
cache_store_coder_behavior.rb Fix spelling 2020-12-27 04:09:49 +10:00
cache_store_version_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
connection_pool_behavior.rb Allow cache tests to be run in parallel 2020-01-24 09:54:55 -08:00
encoded_key_cache_behavior.rb activesupport: Avoid Marshal.load on raw cache value in RedisCacheStore 2020-05-15 15:38:33 -07:00
failure_safety_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
local_cache_behavior.rb Instrument cache entries from local cache 2020-11-04 23:12:21 +00:00