* 0.9.5-DEV
+ * changed the Array and String loaders to actually make use of the cache mechanism
* included the default filter function definitions in the extension class files directly (Core, Escaper)
* added the .. operator (as a syntactic sugar for the range filter when the step is 1)
* added the in operator (as a syntactic sugar for the in filter)
[php]
$loader = new Twig_Loader_Array($templates);
+>**TIP**
+>When using the `Array` or `String` loaders with a cache mechanism, you should
+>know that a new cache key is generated each time a template content "changes"
+>(the cache key being the source code of the template). If you don't want to
+>see your cache grows out of control, you need to take care of clearing the old
+>cache file by yourself.
+
### Create your own Loader
All loaders implement the `Twig_LoaderInterface`:
/**
* Loads a template from an array.
*
+ * When using this loader with a cache mehcanism, you should know that a new cache
+ * key is generated each time a template content "changes" (the cache key being the
+ * source code of the template). If you don't want to see your cache grows out of
+ * control, you need to take care of clearing the old cache file by yourself.
+ *
* @package twig
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id$
*/
public function isFresh($name, $time)
{
- return false;
+ return true;
}
}
/**
* Loads a template from a string.
*
+ * When using this loader with a cache mechanism, you should know that a new cache
+ * key is generated each time a template content "changes" (the cache key being the
+ * source code of the template). If you don't want to see your cache grows out of
+ * control, you need to take care of clearing the old cache file by yourself.
+ *
* @package twig
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id$
*/
public function isFresh($name, $time)
{
- return false;
+ return true;
}
}