CakePHP 3.x How do I clear the cache for views using the console?
My CakePHP 3.x app is hosted on bitbucket.
I have a deployment script that will git clone into a folder that uses a timestamp as the folder name.
The script will then create a symbolic link /var/virtual/webapp/current
to this temporary folder.
However, for some reason, the view files are still cached despite this newly expanded folder. Also the folder is tmp
empty.
How can I clear the cache for viewing files using the console so I can add it to the bash script?
'Cache' => [
'default' => [
'className' => 'File',
'path' => CACHE,
],
/**
* Configure the cache used for general framework caching. Path information,
* object listings, and translation cache files are stored with this
* configuration.
*/
'_cake_core_' => [
'className' => 'File',
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+2 minutes',
],
/**
* Configure the cache for model and datasource caches. This cache
* configuration is used to store schema descriptions, and table listings
* in connections.
*/
'_cake_model_' => [
'className' => 'File',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+2 minutes',
],
],
source to share
So you want to clear the cache from the console?
Doesn't the below work?
// Will only clear expired keys.
Cache::clear(true);
// Will clear all keys.
Cache::clear(false);
You can create a wrapper script and you can put it there.
Or just delete all files in the folder specified for the cache with rm ...
rm -f /path/to/my/cached/files/*
PS
- This does not apply to caching via php opcache. It is allowed? It could also be what caches files like
- Is there also the potential that your script doesn't update the symbolic link in the current directory?
source to share