web/lib/Zend/Cache.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    12  * obtain it through the world-wide-web, please send an email
    12  * obtain it through the world-wide-web, please send an email
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Cache
    16  * @package    Zend_Cache
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @version    $Id: Cache.php 23154 2010-10-18 17:41:06Z mabe $
    19  * @version    $Id: Cache.php 24656 2012-02-26 06:02:53Z adamlundrigan $
    20  */
    20  */
    21 
    21 
    22 
    22 
    23 /**
    23 /**
    24  * @package    Zend_Cache
    24  * @package    Zend_Cache
    25  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    25  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    26  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    26  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    27  */
    27  */
    28 abstract class Zend_Cache
    28 abstract class Zend_Cache
    29 {
    29 {
    30 
    30 
    39      * Standard backends
    39      * Standard backends
    40      *
    40      *
    41      * @var array
    41      * @var array
    42      */
    42      */
    43     public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform',
    43     public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform',
    44                                             'Xcache', 'TwoLevels', 'ZendServer_Disk', 'ZendServer_ShMem');
    44                                             'Xcache', 'TwoLevels', 'WinCache', 'ZendServer_Disk', 'ZendServer_ShMem');
    45 
    45 
    46     /**
    46     /**
    47      * Standard backends which implement the ExtendedInterface
    47      * Standard backends which implement the ExtendedInterface
    48      *
    48      *
    49      * @var array
    49      * @var array
    50      */
    50      */
    51     public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite');
    51     public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Libmemcached', 'Sqlite', 'WinCache');
    52 
    52 
    53     /**
    53     /**
    54      * Only for backward compatibility (may be removed in next major release)
    54      * Only for backward compatibility (may be removed in next major release)
    55      *
    55      *
    56      * @var array
    56      * @var array
    62      * Only for backward compatibility (may be removed in next major release)
    62      * Only for backward compatibility (may be removed in next major release)
    63      *
    63      *
    64      * @var array
    64      * @var array
    65      * @deprecated
    65      * @deprecated
    66      */
    66      */
    67     public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'TwoLevels');
    67     public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Libmemcached', 'Apc', 'ZendPlatform', 'Xcache', 'WinCache', 'TwoLevels');
    68 
    68 
    69     /**
    69     /**
    70      * Consts for clean() method
    70      * Consts for clean() method
    71      */
    71      */
    72     const CLEANING_MODE_ALL              = 'all';
    72     const CLEANING_MODE_ALL              = 'all';
   131             $backendClass = 'Zend_Cache_Backend_' . $backend;
   131             $backendClass = 'Zend_Cache_Backend_' . $backend;
   132             // security controls are explicit
   132             // security controls are explicit
   133             require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
   133             require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
   134         } else {
   134         } else {
   135             // we use a custom backend
   135             // we use a custom backend
   136             if (!preg_match('~^[\w]+$~D', $backend)) {
   136             if (!preg_match('~^[\w\\\\]+$~D', $backend)) {
   137                 Zend_Cache::throwException("Invalid backend name [$backend]");
   137                 Zend_Cache::throwException("Invalid backend name [$backend]");
   138             }
   138             }
   139             if (!$customBackendNaming) {
   139             if (!$customBackendNaming) {
   140                 // we use this boolean to avoid an API break
   140                 // we use this boolean to avoid an API break
   141                 $backendClass = 'Zend_Cache_Backend_' . $backend;
   141                 $backendClass = 'Zend_Cache_Backend_' . $backend;
   173             $frontendClass = 'Zend_Cache_' . ($frontend != 'Core' ? 'Frontend_' : '') . $frontend;
   173             $frontendClass = 'Zend_Cache_' . ($frontend != 'Core' ? 'Frontend_' : '') . $frontend;
   174             // security controls are explicit
   174             // security controls are explicit
   175             require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
   175             require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
   176         } else {
   176         } else {
   177             // we use a custom frontend
   177             // we use a custom frontend
   178             if (!preg_match('~^[\w]+$~D', $frontend)) {
   178             if (!preg_match('~^[\w\\\\]+$~D', $frontend)) {
   179                 Zend_Cache::throwException("Invalid frontend name [$frontend]");
   179                 Zend_Cache::throwException("Invalid frontend name [$frontend]");
   180             }
   180             }
   181             if (!$customFrontendNaming) {
   181             if (!$customFrontendNaming) {
   182                 // we use this boolean to avoid an API break
   182                 // we use this boolean to avoid an API break
   183                 $frontendClass = 'Zend_Cache_Frontend_' . $frontend;
   183                 $frontendClass = 'Zend_Cache_Frontend_' . $frontend;