changed the arguments of generateKey#1822
Conversation
|
I've also deprecated |
97a5f00 to
5f491b5
Compare
There was a problem hiding this comment.
The class name might contain the index with a _x suffix. In this case the directory structure is not randomized evenly anymore. A simple solution would be to just change ´getTemplateClass` to add the index between prefix and hash.
But this still ties to Cache implementation to the class generation, i.e. the cache is basically aware how the class name is generated.
There was a problem hiding this comment.
An architectural better solution would be to hash the class name again and then use two chars from the hash. This would also solve the problem when strlen($className) < 2.
There was a problem hiding this comment.
Good idea, code updated accordingly.
5f491b5 to
c2e75ff
Compare
|
Thanks very much @fabpot, will take this for a spin shortly. |
|
Code looks good to me and this unblocked my work, thanks again. Remaining steps for me are:
|
This PR was merged into the 1.x branch. Discussion ---------- changed the arguments of generateKey We now pass the template name and the template class, which seems much better from a UX standpoint. Passing the prefix was really just a hack and an implementation leak to be able to determine the variable part of the class name and generate sub-directories for templates. Now, we generate the cache key by taking the last characters instead of the first ones, to avoid the need for the class prefix. That should also make Drupal happy :) Commits ------- c2e75ff changed the arguments of generateKey 0157315 deprecated Twig_Environment::getTemplateClassPrefix
We now pass the template name and the template class, which seems much better from a UX standpoint.
Passing the prefix was really just a hack and an implementation leak to be able to determine the variable part of the class name and generate sub-directories for templates. Now, we generate the cache key by taking the last characters instead of the first ones, to avoid the need for the class prefix.
That should also make Drupal happy :)