shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

CacheInterface.php (1447B)


      1 <?php
      2 
      3 /*
      4  * This file is part of Twig.
      5  *
      6  * (c) 2015 Fabien Potencier
      7  *
      8  * For the full copyright and license information, please view the LICENSE
      9  * file that was distributed with this source code.
     10  */
     11 
     12 /**
     13  * Interface implemented by cache classes.
     14  *
     15  * It is highly recommended to always store templates on the filesystem to
     16  * benefit from the PHP opcode cache. This interface is mostly useful if you
     17  * need to implement a custom strategy for storing templates on the filesystem.
     18  *
     19  * @author Andrew Tch <andrew@noop.lv>
     20  */
     21 interface Twig_CacheInterface
     22 {
     23     /**
     24      * Generates a cache key for the given template class name.
     25      *
     26      * @param string $name      The template name
     27      * @param string $className The template class name
     28      *
     29      * @return string
     30      */
     31     public function generateKey($name, $className);
     32 
     33     /**
     34      * Writes the compiled template to cache.
     35      *
     36      * @param string $key     The cache key
     37      * @param string $content The template representation as a PHP class
     38      */
     39     public function write($key, $content);
     40 
     41     /**
     42      * Loads a template from the cache.
     43      *
     44      * @param string $key The cache key
     45      */
     46     public function load($key);
     47 
     48     /**
     49      * Returns the modification timestamp of a key.
     50      *
     51      * @param string $key The cache key
     52      *
     53      * @return int
     54      */
     55     public function getTimestamp($key);
     56 }