Nette app without cache (No temp folder at all)

Notice: This thread is very old.
dkorpar
Member | 132
+
0
-

I'm using nette with gearman for my worker app. Once started worker runs for long time (weeks) until it's updated or whatever. Caching configuration and containers for services is not needed because it's only one step more every time I redeploy up I have to delete the cache folder, and since this is script that runs once for a long time (not classic web request/response) there's no real benefit of this.
So my question is what would be the fastest way to avoid this?

Last edited by dkorpar (2016-03-10 12:24)

Luděk Veselý
Member | 29
+
+1
-

You can disable caching with DevNullStorage.

Michal Vyšinský
Member | 608
+
+1
-

Hi,
you can use DevNullStorage

I am not completely sure how to do it in config.neon, but something like this should be a way how to avoid creation of ‘temp/cache’ folder completely:

remove ‘cache’ extension in bootstrap.php (before calling $configurator->createContainer()):

unset($configurator->defaultExtensions['cache']);

register service in configuration neon file to aviod missing service exceptions:

services:
    - Nette\Caching\Storages\DevNullStorage

Last edited by Michal Vyšinský (2016-03-10 12:53)

dkorpar
Member | 132
+
0
-

So I've tried with

unset($configurator->defaultExtensions['cache']);
$container = $configurator->createContainer();

and

cacheStorage: Nette\Caching\Storages\DevNullStorage

but Nette.Configurator folder is still created with container files. Maybe it has to be created, but I want to make sure that at least it will be overwritten on every call?
I'm getting closer to just delete the temp/cache folder on bootstrap.php before creating container, although it's not the best solution

Last edited by dkorpar (2016-03-10 14:30)

hrach
Member | 1834
+
+3
-

The only good answer is: don't do it, tweak your deploy process instead.

dkorpar
Member | 132
+
0
-

Not sure, basically this is daemon, and after I deploy it it should delete all cache…
then I can only run systemctl restart, after deploy without any concern that something was created between deploy process and restarting daemon …