If you are having problems with the permissions of the cache files that Twig compiles this may point you in the right direction.
To bring you up to speed, Twig will compile Twig templates into native php once parsed, this ensures that they are rendered as fast as possible.
My specific use case is that some templates are compiled on the command line as a different user than apache which compiles them from web requests. When generating templates from various users I ran into permissions where the cli user couldn’t create cache files in folders that were previously created by Apache. The cli user and Apache both are in the same group so I just needed to make sure that all folders and files (for clearing the cache) are owned by the common group, which is easier said than done.