My CakePHP 3.x app is hosted in bitbucket.
I have a deploy script that will git clone to a folder that uses timestamp as folder name.
After which the script will then create symlink /var/virtual/webapp/current
to this timestamped folder.
However, for some reason, the view files are still cached despite this newly deployed folder. Also the tmp
folder is empty.
How do I clear cache for view files using the console, so I can add it into 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',
],
],
Try this
// Clear one cache config
bin/cake cache clear <configname>
// Clear all cache configs
bin/cake cache clear_all
You can use next command to clear all cache via console: bin/cake console Cake\Cache\Cache::clear(false)
CakePHP: Clearing Cached Data
So you want to clear the cache from the console?
Clearing Cache in Cakephp
Does the below not work for you?
// Will only clear expired keys.
Cache::clear(true);
// Will clear all keys.
Cache::clear(false);
You could create a shell script and could put it there.
Shells and Console
Or just delete all the files in the folder you specified for cache with rm...
rm -f /path/to/my/cached/files/*
P.S.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With