Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Nate Pinsky
committed
Dec 29, 2020
1 parent
96446a9
commit fd8c367
Showing
2 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters