[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/Cache/ -> zps4.php (source)

   1  <?php
   2  /**
   3   * The Horde_Cache_zps4:: class provides a Zend Performance Suite
   4   * (version 4.0+) implementation of the Horde caching system.
   5   *
   6   * $Horde: framework/Cache/Cache/zps4.php,v 1.1.10.4 2006/01/01 21:28:10 jan Exp $
   7   *
   8   * Copyright 1999-2006 Chuck Hagenbuch <chuck@horde.org>
   9   *
  10   * See the enclosed file COPYING for license information (LGPL). If you
  11   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  12   *
  13   * @author  Chuck Hagenbuch <chuck@horde.org>
  14   * @since   Horde 3.0
  15   * @package Horde_Cache
  16   */
  17  class Horde_Cache_zps4 extends Horde_Cache {
  18  
  19      /**
  20       * Attempts to retrieve a piece of cached data and return it to the caller.
  21       *
  22       * @param string  $key       Cache key to fetch.
  23       * @param integer $lifetime  Lifetime of the key in seconds.
  24       *
  25       * @return mixed  Cached data, or false if none was found.
  26       */
  27      function get($key, $lifetime = 1)
  28      {
  29          return output_cache_get($key, $lifetime);
  30      }
  31  
  32      /**
  33       * Attempts to store an object to the cache.
  34       *
  35       * @param string $key   Cache key (identifier).
  36       * @param mixed  $data  Data to store in the cache.
  37       *
  38       * @return boolean  True on success, false on failure.
  39       */
  40      function set($key, $data)
  41      {
  42          output_cache_put($key, $data);
  43          return true;
  44      }
  45  
  46      /**
  47       * Attempts to directly output cached data.
  48       *
  49       * @param string  $key       Cache key to output.
  50       * @param integer $lifetime  Lifetime of the key in seconds.
  51       *
  52       * @return mixed  Cached data, or false if none was found.
  53       */
  54      function output($key, $lifetime = 1)
  55      {
  56          echo $this->fetch($key, $lifetime);
  57      }
  58  
  59      /**
  60       * Checks if a given key exists in the cache, valid for the given lifetime.
  61       *
  62       * @param string  $key       Cache key to check.
  63       * @param integer $lifetime  Lifetime of the key in seconds.
  64       *
  65       * @return boolean  Existance.
  66       */
  67      function exists($key, $lifetime = 1)
  68      {
  69          $exists = output_cache_exists($key, $lifetime);
  70          output_cache_stop();
  71          return $exists;
  72      }
  73  
  74      /**
  75       * Expire any existing data for the given key.
  76       *
  77       * @param string $key  Cache key to expire.
  78       *
  79       * @return boolean  Success or failure.
  80       */
  81      function expire($key)
  82      {
  83          return output_cache_remove_key($key);
  84      }
  85  
  86  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7