Sergey
3. Oktober 2016 um 10:50
1
Hi guys.
I need to override path to the cache directory. This path locates in the Shopware\Kernel.php file
From what I could find, it is I can only extend Kernel and modify the shopware.php file but it is not a good solution.
Symfony 2/3 framework has AppKernel class where we can override the getCacheDir method.
My question is - how I can change a path to the cache directory without changing the shopware.php file?
May I ask you why you’d like to do that?
I think that’s a bad idea at all, because for each SW Update you have to do the same steps over and over again
Sergey
3. Oktober 2016 um 11:57
3
This modification can be of interest if you are working in a virtual environment and cannot use NFS - for example, if you’re running a Symfony application using Vagrant/VirtualBox in a guest operating system.
shyim
3. Oktober 2016 um 12:15
4
You can override it in our config.php on root of our installation.
Look at: shopware/Default.php at 5.2 · shopware/shopware · GitHub
1 „Gefällt mir“
You can also simply define it in your config_*.php file:
'cache' => [
'frontendOptions' => [
'automatic_serialization' => true,
'automatic_cleaning_factor' => 0,
'lifetime' => 3600,
'cache_id_prefix' => md5($this->getCacheDir())
],
'backend' => 'auto', // e.G auto, apcu, xcache
'backendOptions' => [
'hashed_directory_perm' => 0777 & ~umask(),
'cache_file_perm' => 0666 & ~umask(),
'hashed_directory_level' => 3,
'cache_dir' => $this->getCacheDir().'/general',
'file_name_prefix' => 'shopware'
],
],
and for your HTTP Cache:
'httpcache' => [
'enabled' => true,
'lookup_optimization' => true,
'debug' => false,
'default_ttl' => 0,
'private_headers' => ['Authorization', 'Cookie'],
'allow_reload' => false,
'allow_revalidate' => false,
'stale_while_revalidate' => 2,
'stale_if_error' => false,
'cache_dir' => $this->getCacheDir().'/html',
'cache_cookies' => ['shop', 'currency', 'x-cache-context-hash'],
],
1 „Gefällt mir“