Closed usox closed 7 years ago
millions of different templates
This... is very fishy. What is the use-case here? Why are there so many templates? (Can't imagine that user input is involved)
In general I am not against adding subpath support but I do agree with @Ocramius that, if this were to be added, the logic for it should be kept out of the PHPTAL class to avoid bloat (both now and for future additions).
@Ocramius We're using phptal to create highly customizable emails and webpages. Our render engine allows a nearly unlimited amount of nested templates and template-parts which are created using separate phptal render processes (having 10+ separate phptal render processes for a single webpage is not unusual). That's the reason, we create millions of cache files within hours and already had some inode-related trouble with the filesystems on our servers.
That's the reason, we create millions of cache files within hours and already had some inode-related trouble with the filesystems on our servers.
Considering that, did you check if there is a high impact by just not using the caches at all?
Considering that, did you check if there is a high impact by just not using the caches at all?
Yep, we ran into some performance issues which of course depend on the templates and the level of customization. The current TTL of the templates is 3 days...
In general, there is no urge to get this code merged as we maintain our own phptal fork with a set of patches. If you/we decide, it would be a nice idea for a coming CacheHandler/Writer/Reader/whatever, I would write it that way. If our case it too edgy for the offical repo, I will continue patching phptal myself :)
When using tal with a high amount of different templates and macros (I'm talking about millions of different templates), the code destination folder gets filled up with cache files within no time - especially if you dont want to clear the directory every 10 minutes. This slows down the filesystem access to the specific directory (depends on the environment - filesystemtype, nfs, etc.).
This patch introduces a configurable level of subpaths which are added to the phpCodeDestination to create a structure of max 32 subpaths with 0 as default to avoid impacts on existing installations.