Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patTemplate

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pattemplate/patTemplate/TemplateCache/eAccelerator.php

Documentation is available at eAccelerator.php

  1. <?PHP
  2. /**
  3.  * patTemplate Template cache that stores data in the eAccelerator Cache
  4.  *
  5.  * $Id: eAccelerator.php 364 2005-02-19 09:39:45Z schst $
  6.  *
  7.  * @package        patTemplate
  8.  * @subpackage    Caches
  9.  * @author        Mike Valstar <[email protected]>
  10.  */
  11.  
  12. // Check to ensure this file is within the rest of the framework
  13. defined('JPATH_BASE'or die();
  14.  
  15. /**
  16.  * patTemplate Template cache that stores data in the eAccelerator Cache
  17.  *
  18.  * If the lifetime is set to auto, the cache files will be kept until
  19.  * you delete them manually.
  20.  *
  21.  * $Id: eAccelerator.php 364 2005-02-19 09:39:45Z schst $
  22.  *
  23.  * @package        patTemplate
  24.  * @subpackage    Caches
  25.  * @author        Mike Valstar <[email protected]>
  26.  */
  27. {
  28.    /**
  29.     * parameters of the cache
  30.     *
  31.     * @access    private
  32.     * @var        array 
  33.     */
  34.     var $_params = array'lifetime' => 'auto');
  35.  
  36.    /**
  37.     * load template from cache
  38.     *
  39.     * @access   public
  40.     * @param    string            cache key
  41.     * @param    integer            modification time of original template
  42.     * @return   array|boolean   either an array containing the templates or false cache could not be loaded
  43.     */
  44.     function load$key$modTime = -)
  45.     {
  46.         if (!function_exists('eaccelerator_lock')) {
  47.             return false;
  48.         }
  49.         $something eaccelerator_get($key);
  50.         if (is_null($something)){
  51.             return false;
  52.         }else{
  53.             return unserialize($something);
  54.         }
  55.     }
  56.  
  57.    /**
  58.     * write template to cache
  59.     *
  60.     * @access   public
  61.     * @param    string        cache key
  62.     * @param    array        templates to store
  63.     * @return   boolean        true on success
  64.     */
  65.     function write$key$templates )
  66.     {
  67.         if (!function_exists('eaccelerator_lock')) {
  68.             return false;
  69.         }
  70.  
  71.         eaccelerator_lock($key);
  72.         if ($this->getParam'lifetime' == 'auto'){
  73.              eaccelerator_put($keyserialize$templates ));
  74.         }else{
  75.             eaccelerator_put($keyserialize$templates )$this->getParam'lifetime' 60);
  76.         }
  77.          eaccelerator_unlock($key);
  78.  
  79.          return true;
  80.     }
  81. }
  82. ?>

Documentation generated on Mon, 05 Mar 2007 20:57:01 +0000 by phpDocumentor 1.3.1