Tyranron Tyranron - 1 year ago 150
PHP Question

What is idiomatic way to clear whole cache in Twig since 1.22.x?


version of
, method
is deprecated. However, I didn't found anywhere (nor in documentation, nor in repo tickets, nor here on SO) something which can replace this deprecated method.

So what is the idiomatic (and not deprecated) way to clear all cache files now?

Clearing those files via implementing own function seems to be pretty weird.

Answer Source

So there is no new idiomatic way to clear all cache files.
Twig project maintainers leave it for library users on their own. The arguments are:

The argument was that Twig itself will only support filesystem cache (due to opcache). Thus clear() would be the same as removing the cache folder manually. Thus it doesn't need to be in the interface. So you have to clear your cache either manually or write the method yourself.

More details may be read in relevant issue early referred by @alain-tiemblo in comments.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download