-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolved issues with cache driver not being used #2760
base: 7.dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments on code.
Also noting that we need to actually test this when using driver different than file
if (! ee()->cache->file->is_supported()) { | ||
if (! ee()->cache->is_writable() && ee()->cache->get_adapter() == 'file') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this change.
The docs are requiring /user/cache folder
to be writable, and it has always been like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will just always throw a warning if EE is deployed to a serverless host where system/user/cache cannot be writable. Another option would be to allow the cache folder to be configurable. Usually the /tmp
folder is writable even in these environments but still the file cache driver doesn't work because the machine is destroyed after every request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does that mean you can set cache driver to "dummy", have system/user/cache
folder NOT writeable and EE still would work as expected (thinking of query caching, tag caching, template caching)?
I think we need to actually test that before making this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this definitely needs some testing, I just wanted to get the PR open so we could start that process. I think we should target a later release for this after it has been tested thoroughly.
EE should still function with any cache driver set otherwise I would think that's a fault with the caching system. In my opinion caching shouldn't be necessary but should provide a performance benefit when enabled. Anyone choosing to use the dummy
driver should still have a functioning site but gaining no performance benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache directory (PATH_CACHE
) is also being used for other things (exporting, running 1-click updates etc.). If it's not writable, EE will not function correctly. If some environments can't make it writable, then we need a fix for those cases - not removing the check.
I'm fine with other changes, but not this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I did a search on PATH_CACHE and it looks like it's being used in a lot of places to write files where we should really refactor to using the cache driver.
Updates are something we'll need to think about, they aren't really possible in a serverless environment without a persistent filesystem mount. So perhaps this warning should be tied to if 1-click updates are enabled in the config? We really just need some way for people running EE on a serverless environment with a read-only disk to not see this warning on every page load.
*/ | ||
public function is_writable($key = '', $scope = Cache::LOCAL_SCOPE) | ||
{ | ||
if(method_exists($this->{$this->_adapter}, 'is_writable')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a space after if
There are parts of the core that override the user's choice of cache driver and require the file cache. This is confusing and particularly problematic in serverless environments where the file driver is not useful. This change attempts to standardize more functionality and always rely on the user selected cache driver.