FOUR-20532 clear cache by pattern#7795
Merged
caleeli merged 3 commits intoepic/FOUR-20326from Dec 6, 2024
Merged
Conversation
8ba0527 to
f3021b1
Compare
caleeli
reviewed
Dec 5, 2024
| public function __construct(CacheManager $cacheManager) | ||
| { | ||
| $this->cacheManager = $cacheManager; | ||
| $driver = env('CACHE_SETTING_DRIVER') ?? env('CACHE_DRIVER', 'redis'); |
Contributor
There was a problem hiding this comment.
Use config instead of env.
In a production environment the .env file is not loaded, only the config from cache.
caleeli
reviewed
Dec 5, 2024
| // get the connection name from the cache manager | ||
| $connection = $this->cacheManager->connection()->getName(); | ||
| // Get all keys | ||
| $keys = Redis::connection($connection)->keys('*'); |
Contributor
There was a problem hiding this comment.
What if the cache drive is not Redis?
Consider to close the Settings driver CACHE_SETTING_DRIVER to be always cache_settings or implement a general logic for other types of drivers.
Contributor
Author
There was a problem hiding this comment.
A validation was added
caleeli
reviewed
Dec 5, 2024
| { | ||
| \SettingCache::clear(); | ||
|
|
||
| putenv('CACHE_SETTING_DRIVER'); |
Contributor
There was a problem hiding this comment.
consider to use config instead of env
…prove clearBy method
8db2885 to
2c61caa
Compare
|
caleeli
approved these changes
Dec 6, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Issue & Reproduction Steps
Clear settings cache by pattern
Solution
Related Tickets & Packages
FOUR-20532
FOUR-20908
Code Review Checklist