Source for file CacheFactory.php

Documentation is available at CacheFactory.php

  1. <?php
  2. /**
  3.  * Data Structures for PHP similar to Java's HashSet and LinkedHashSet.  Uses
  4.  * memcached as a storage mechanism for persisting set data beyond the scope of
  5.  * the current request.
  6.  * 
  7.  * Requires: {@link http://www.php.net/ PHP 5},
  8.  * {@link http://www.danga.com/memcached/ memcached} and
  9.  * {@link http://pecl.php.net/memcache pecl_memcache}
  10.  * 
  11.  * License:
  12.  * 
  13.  * Permission is hereby granted, free of charge, to any person obtaining a copy
  14.  * of this software and associated documentation files (the "Software"), to
  15.  * deal in the Software without restriction, including without limitation the
  16.  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  17.  * sell copies of the Software, and to permit persons to whom the Software is
  18.  * furnished to do so, subject to the following conditions:
  19.  * 
  20.  * The above copyright notice and this permission notice shall be included in
  21.  * all copies or substantial portions of the Software.
  22.  * 
  23.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  26.  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27.  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28.  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  29.  * IN THE SOFTWARE.
  30.  * 
  31.  * @category   HighPerformance
  32.  * @package    CacheSets
  33.  * @author     Jeff Trudeau
  34.  * @copyright  Coypright (c) 2008 Jeff Trudeau
  35.  * @license    http://www.opensource.org/licenses/mit-license.php MIT License
  36.  * @filesource
  37.  */
  38.  
  39. require_once(dirname(__FILE__) . '/Cache.php');
  40.  
  41. /**
  42.  * Factory class for providing access to a static Cache object.  This provides
  43.  * a nice way to intantiate only one instance of Cache per request.
  44.  */
  45. class CacheFactory {
  46.     
  47.     /**
  48.      * @staticvar Cache 
  49.      */
  50.     private static $cache;
  51.     
  52.     /**
  53.      * Returns an instance of Cache
  54.      * 
  55.      * @return mixed 
  56.      */
  57.     public static function getInstance() {
  58.         if (self::$cache == null) {
  59.             self::$cache = new Cache();
  60.         }
  61.         return self::$cache;
  62.     }
  63. }
  64.  
  65. ?>

Documentation generated on Thu, 14 Feb 2008 09:14:27 -0500 by phpDocumentor 1.4.1