Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2010-06-23 07:02:26 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2010-06-23 07:02:26 +0400
commit999f46479294713104c962bfe7469e9b6e7a4bbf (patch)
treea22e349d850bc2f2946a85a3cab373c4b6dc1809 /libs/Zend/Cache/Backend
parent462d78c290f19dd691d9634bf2b17d2adc4446af (diff)
parentc0b42ff664a0846064df23db232ea774931ab7a3 (diff)
0.6.3?
Diffstat (limited to 'libs/Zend/Cache/Backend')
-rw-r--r--libs/Zend/Cache/Backend/Apc.php60
-rw-r--r--libs/Zend/Cache/Backend/BlackHole.php250
-rw-r--r--libs/Zend/Cache/Backend/ExtendedInterface.php36
-rw-r--r--libs/Zend/Cache/Backend/File.php25
-rw-r--r--libs/Zend/Cache/Backend/Interface.php6
-rw-r--r--libs/Zend/Cache/Backend/Memcached.php74
-rw-r--r--libs/Zend/Cache/Backend/Sqlite.php10
-rw-r--r--libs/Zend/Cache/Backend/Static.php558
-rw-r--r--libs/Zend/Cache/Backend/Test.php162
-rw-r--r--libs/Zend/Cache/Backend/TwoLevels.php59
-rw-r--r--libs/Zend/Cache/Backend/Xcache.php12
-rw-r--r--libs/Zend/Cache/Backend/ZendPlatform.php10
-rw-r--r--libs/Zend/Cache/Backend/ZendServer.php10
-rw-r--r--libs/Zend/Cache/Backend/ZendServer/Disk.php28
-rw-r--r--libs/Zend/Cache/Backend/ZendServer/ShMem.php10
15 files changed, 164 insertions, 1146 deletions
diff --git a/libs/Zend/Cache/Backend/Apc.php b/libs/Zend/Cache/Backend/Apc.php
index e25bd397bb..fd99ae45ef 100644
--- a/libs/Zend/Cache/Backend/Apc.php
+++ b/libs/Zend/Cache/Backend/Apc.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Apc.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Apc.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -166,18 +166,18 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* Return true if the automatic cleaning is available for the backend
*
* DEPRECATED : use getCapabilities() instead
- *
- * @deprecated
+ *
+ * @deprecated
* @return boolean
*/
public function isAutomaticCleaningAvailable()
{
return false;
}
-
+
/**
* Return the filling percentage of the backend storage
- *
+ *
* @throws Zend_Cache_Exception
* @return int integer between 0 and 100
*/
@@ -195,21 +195,21 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
}
return ((int) (100. * ($memUsed / $memSize)));
}
-
+
/**
* Return an array of stored tags
*
* @return array array of stored tags (string)
*/
public function getTags()
- {
+ {
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
return array();
}
-
+
/**
* Return an array of stored cache ids which match given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -218,26 +218,26 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
public function getIdsMatchingTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
/**
* Return an array of stored cache ids which don't match given tags
- *
+ *
* In case of multiple tags, a logical OR is made between tags
*
* @param array $tags array of tags
* @return array array of not matching cache ids (string)
- */
+ */
public function getIdsNotMatchingTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
-
+
/**
* Return an array of stored cache ids which match any given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -246,12 +246,12 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
public function getIdsMatchingAnyTags($tags = array())
{
$this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_APC_BACKEND);
- return array();
+ return array();
}
-
+
/**
* Return an array of stored cache ids
- *
+ *
* @return array array of stored cache ids (string)
*/
public function getIds()
@@ -264,7 +264,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
}
return $res;
}
-
+
/**
* Return an array of metadatas for the given cache id
*
@@ -272,7 +272,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* - expire : the expire timestamp
* - tags : a string array of tags
* - mtime : timestamp of last modification time
- *
+ *
* @param string $id cache id
* @return array array of metadatas (false if the cache id is not found)
*/
@@ -294,9 +294,9 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
'mtime' => $mtime
);
}
- return false;
+ return false;
}
-
+
/**
* Give (if possible) an extra lifetime to the given cache id
*
@@ -318,17 +318,17 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
$lifetime = $tmp[2];
$newLifetime = $lifetime - (time() - $mtime) + $extraLifetime;
if ($newLifetime <=0) {
- return false;
+ return false;
}
apc_store($id, array($data, time(), $newLifetime), $newLifetime);
return true;
}
return false;
}
-
+
/**
* Return an associative array of capabilities (booleans) of the backend
- *
+ *
* The array must include these keys :
* - automatic_cleaning (is automating cleaning necessary)
* - tags (are tags supported)
@@ -337,7 +337,7 @@ class Zend_Cache_Backend_Apc extends Zend_Cache_Backend implements Zend_Cache_Ba
* - priority does the backend deal with priority when saving
* - infinite_lifetime (is infinite lifetime can work with this backend)
* - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
+ *
* @return array associative of with capabilities
*/
public function getCapabilities()
diff --git a/libs/Zend/Cache/Backend/BlackHole.php b/libs/Zend/Cache/Backend/BlackHole.php
deleted file mode 100644
index 3eb382eca2..0000000000
--- a/libs/Zend/Cache/Backend/BlackHole.php
+++ /dev/null
@@ -1,250 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Cache
- * @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: BlackHole.php 17867 2009-08-28 09:42:11Z yoshida@zend.co.jp $
- */
-
-/**
- * @see Zend_Cache_Backend_Interface
- */
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
-
-/**
- * @see Zend_Cache_Backend
- */
-// require_once 'Zend/Cache/Backend.php';
-
-/**
- * @package Zend_Cache
- * @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Cache_Backend_BlackHole
- extends Zend_Cache_Backend
- implements Zend_Cache_Backend_ExtendedInterface
-{
- /**
- * Test if a cache is available for the given id and (if yes) return it (false else)
- *
- * @param string $id cache id
- * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
- * @return string|false cached datas
- */
- public function load($id, $doNotTestCacheValidity = false)
- {
- return false;
- }
-
- /**
- * Test if a cache is available or not (for the given id)
- *
- * @param string $id cache id
- * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
- */
- public function test($id)
- {
- return false;
- }
-
- /**
- * Save some string datas into a cache record
- *
- * Note : $data is always "string" (serialization is done by the
- * core not by the backend)
- *
- * @param string $data Datas to cache
- * @param string $id Cache id
- * @param array $tags Array of strings, the cache record will be tagged by each string entry
- * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
- * @return boolean true if no problem
- */
- public function save($data, $id, $tags = array(), $specificLifetime = false)
- {
- return true;
- }
-
- /**
- * Remove a cache record
- *
- * @param string $id cache id
- * @return boolean true if no problem
- */
- public function remove($id)
- {
- return true;
- }
-
- /**
- * Clean some cache records
- *
- * Available modes are :
- * 'all' (default) => remove all cache entries ($tags is not used)
- * 'old' => remove too old cache entries ($tags is not used)
- * 'matchingTag' => remove cache entries matching all given tags
- * ($tags can be an array of strings or a single string)
- * 'notMatchingTag' => remove cache entries not matching one of the given tags
- * ($tags can be an array of strings or a single string)
- * 'matchingAnyTag' => remove cache entries matching any given tags
- * ($tags can be an array of strings or a single string)
- *
- * @param string $mode clean mode
- * @param tags array $tags array of tags
- * @return boolean true if no problem
- */
- public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
- {
- return true;
- }
-
- /**
- * Return an array of stored cache ids
- *
- * @return array array of stored cache ids (string)
- */
- public function getIds()
- {
- return array();
- }
-
- /**
- * Return an array of stored tags
- *
- * @return array array of stored tags (string)
- */
- public function getTags()
- {
- return array();
- }
-
- /**
- * Return an array of stored cache ids which match given tags
- *
- * In case of multiple tags, a logical AND is made between tags
- *
- * @param array $tags array of tags
- * @return array array of matching cache ids (string)
- */
- public function getIdsMatchingTags($tags = array())
- {
- return array();
- }
-
- /**
- * Return an array of stored cache ids which don't match given tags
- *
- * In case of multiple tags, a logical OR is made between tags
- *
- * @param array $tags array of tags
- * @return array array of not matching cache ids (string)
- */
- public function getIdsNotMatchingTags($tags = array())
- {
- return array();
- }
-
- /**
- * Return an array of stored cache ids which match any given tags
- *
- * In case of multiple tags, a logical AND is made between tags
- *
- * @param array $tags array of tags
- * @return array array of any matching cache ids (string)
- */
- public function getIdsMatchingAnyTags($tags = array())
- {
- return array();
- }
-
- /**
- * Return the filling percentage of the backend storage
- *
- * @return int integer between 0 and 100
- * @throws Zend_Cache_Exception
- */
- public function getFillingPercentage()
- {
- return 0;
- }
-
- /**
- * Return an array of metadatas for the given cache id
- *
- * The array must include these keys :
- * - expire : the expire timestamp
- * - tags : a string array of tags
- * - mtime : timestamp of last modification time
- *
- * @param string $id cache id
- * @return array array of metadatas (false if the cache id is not found)
- */
- public function getMetadatas($id)
- {
- return false;
- }
-
- /**
- * Give (if possible) an extra lifetime to the given cache id
- *
- * @param string $id cache id
- * @param int $extraLifetime
- * @return boolean true if ok
- */
- public function touch($id, $extraLifetime)
- {
- return false;
- }
-
- /**
- * Return an associative array of capabilities (booleans) of the backend
- *
- * The array must include these keys :
- * - automatic_cleaning (is automating cleaning necessary)
- * - tags (are tags supported)
- * - expired_read (is it possible to read expired cache records
- * (for doNotTestCacheValidity option for example))
- * - priority does the backend deal with priority when saving
- * - infinite_lifetime (is infinite lifetime can work with this backend)
- * - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
- * @return array associative of with capabilities
- */
- public function getCapabilities()
- {
- return array(
- 'automatic_cleaning' => true,
- 'tags' => true,
- 'expired_read' => true,
- 'priority' => true,
- 'infinite_lifetime' => true,
- 'get_list' => true,
- );
- }
-
- /**
- * PUBLIC METHOD FOR UNIT TESTING ONLY !
- *
- * Force a cache record to expire
- *
- * @param string $id cache id
- */
- public function ___expire($id)
- {
- }
-}
diff --git a/libs/Zend/Cache/Backend/ExtendedInterface.php b/libs/Zend/Cache/Backend/ExtendedInterface.php
index f24ecc1091..22e559b25b 100644
--- a/libs/Zend/Cache/Backend/ExtendedInterface.php
+++ b/libs/Zend/Cache/Backend/ExtendedInterface.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ExtendedInterface.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: ExtendedInterface.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interface
@@ -36,21 +36,21 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
/**
* Return an array of stored cache ids
- *
+ *
* @return array array of stored cache ids (string)
*/
public function getIds();
-
+
/**
* Return an array of stored tags
*
* @return array array of stored tags (string)
*/
public function getTags();
-
+
/**
* Return an array of stored cache ids which match given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
@@ -60,24 +60,24 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
/**
* Return an array of stored cache ids which don't match given tags
- *
+ *
* In case of multiple tags, a logical OR is made between tags
*
* @param array $tags array of tags
* @return array array of not matching cache ids (string)
- */
+ */
public function getIdsNotMatchingTags($tags = array());
/**
* Return an array of stored cache ids which match any given tags
- *
+ *
* In case of multiple tags, a logical AND is made between tags
*
* @param array $tags array of tags
* @return array array of any matching cache ids (string)
*/
public function getIdsMatchingAnyTags($tags = array());
-
+
/**
* Return the filling percentage of the backend storage
*
@@ -92,12 +92,12 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* - expire : the expire timestamp
* - tags : a string array of tags
* - mtime : timestamp of last modification time
- *
+ *
* @param string $id cache id
* @return array array of metadatas (false if the cache id is not found)
*/
public function getMetadatas($id);
-
+
/**
* Give (if possible) an extra lifetime to the given cache id
*
@@ -106,10 +106,10 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* @return boolean true if ok
*/
public function touch($id, $extraLifetime);
-
+
/**
* Return an associative array of capabilities (booleans) of the backend
- *
+ *
* The array must include these keys :
* - automatic_cleaning (is automating cleaning necessary)
* - tags (are tags supported)
@@ -118,9 +118,9 @@ interface Zend_Cache_Backend_ExtendedInterface extends Zend_Cache_Backend_Interf
* - priority does the backend deal with priority when saving
* - infinite_lifetime (is infinite lifetime can work with this backend)
* - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
+ *
* @return array associative of with capabilities
*/
public function getCapabilities();
-
+
}
diff --git a/libs/Zend/Cache/Backend/File.php b/libs/Zend/Cache/Backend/File.php
index eeddfa5b80..51e2697ad9 100644
--- a/libs/Zend/Cache/Backend/File.php
+++ b/libs/Zend/Cache/Backend/File.php
@@ -15,26 +15,26 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: File.php 21642 2010-03-25 17:07:02Z mabe $
+ * @version $Id: File.php 17868 2009-08-28 09:46:30Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -123,8 +123,8 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$this->setCacheDir(self::getTmpDir() . DIRECTORY_SEPARATOR, false);
}
if (isset($this->_options['file_name_prefix'])) { // particular case for this option
- if (!preg_match('~^[a-zA-Z0-9_]+$~D', $this->_options['file_name_prefix'])) {
- Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-Z0-9_]');
+ if (!preg_match('~^[\w]+$~', $this->_options['file_name_prefix'])) {
+ Zend_Cache::throwException('Invalid file_name_prefix : must use only [a-zA-A0-9_]');
}
}
if ($this->_options['metadatas_array_max_size'] < 10) {
@@ -647,7 +647,6 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$prefix = $this->_options['file_name_prefix'];
$glob = @glob($dir . $prefix . '--*');
if ($glob === false) {
- // On some systems it is impossible to distinguish between empty match and an error.
return true;
}
foreach ($glob as $file) {
@@ -740,8 +739,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
$prefix = $this->_options['file_name_prefix'];
$glob = @glob($dir . $prefix . '--*');
if ($glob === false) {
- // On some systems it is impossible to distinguish between empty match and an error.
- return array();
+ return true;
}
foreach ($glob as $file) {
if (is_file($file)) {
@@ -804,12 +802,7 @@ class Zend_Cache_Backend_File extends Zend_Cache_Backend implements Zend_Cache_B
}
if ((is_dir($file)) and ($this->_options['hashed_directory_level']>0)) {
// Recursive call
- $recursiveRs = $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags);
- if ($recursiveRs === false) {
- $this->_log('Zend_Cache_Backend_File::_get() / recursive call : can\'t list entries of "'.$file.'"');
- } else {
- $result = array_unique(array_merge($result, $recursiveRs));
- }
+ $result = array_unique(array_merge($result, $this->_get($file . DIRECTORY_SEPARATOR, $mode, $tags)));
}
}
return array_unique($result);
diff --git a/libs/Zend/Cache/Backend/Interface.php b/libs/Zend/Cache/Backend/Interface.php
index 3e8c7d1211..f2878f95ae 100644
--- a/libs/Zend/Cache/Backend/Interface.php
+++ b/libs/Zend/Cache/Backend/Interface.php
@@ -15,16 +15,16 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Interface.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/Memcached.php b/libs/Zend/Cache/Backend/Memcached.php
index 3c29bcce67..86bbca3a1c 100644
--- a/libs/Zend/Cache/Backend/Memcached.php
+++ b/libs/Zend/Cache/Backend/Memcached.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Memcached.php 22208 2010-05-20 16:59:02Z mabe $
+ * @version $Id: Memcached.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
@@ -155,16 +155,16 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
$server['failure_callback'] = self::DEFAULT_FAILURE_CALLBACK;
}
if ($this->_options['compatibility']) {
- // No status for compatibility mode (#ZF-5887)
- $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
+ // No status for compatibility mode (#ZF-5887)
+ $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
$server['weight'], $server['timeout'],
$server['retry_interval']);
- } else {
- $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
+ } else {
+ $this->_memcache->addServer($server['host'], $server['port'], $server['persistent'],
$server['weight'], $server['timeout'],
$server['retry_interval'],
$server['status'], $server['failure_callback']);
- }
+ }
}
}
@@ -178,7 +178,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
public function load($id, $doNotTestCacheValidity = false)
{
$tmp = $this->_memcache->get($id);
- if (is_array($tmp) && isset($tmp[0])) {
+ if (is_array($tmp)) {
return $tmp[0];
}
return false;
@@ -219,14 +219,13 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
} else {
$flag = 0;
}
-
- // ZF-8856: using set because add needs a second request if item already exists
- $result = @$this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
-
+ // #ZF-5702 : we try add() first becase set() seems to be slower
+ if (!($result = $this->_memcache->add($id, array($data, time(), $lifetime), $flag, $lifetime))) {
+ $result = $this->_memcache->set($id, array($data, time(), $lifetime), $flag, $lifetime);
+ }
if (count($tags) > 0) {
- $this->_log(self::TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND);
+ $this->_log("Zend_Cache_Backend_Memcached::save() : tags are unsupported by the Memcached backend");
}
-
return $result;
}
@@ -238,7 +237,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
*/
public function remove($id)
{
- return $this->_memcache->delete($id, 0);
+ return $this->_memcache->delete($id);
}
/**
@@ -381,26 +380,25 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
{
$mems = $this->_memcache->getExtendedStats();
- $memSize = null;
- $memUsed = null;
+ $memSize = 0;
+ $memUsed = 0;
foreach ($mems as $key => $mem) {
- if ($mem === false) {
- $this->_log('can\'t get stat from ' . $key);
- continue;
- }
-
- $eachSize = $mem['limit_maxbytes'];
- $eachUsed = $mem['bytes'];
- if ($eachUsed > $eachSize) {
- $eachUsed = $eachSize;
- }
-
- $memSize += $eachSize;
- $memUsed += $eachUsed;
- }
-
- if ($memSize === null || $memUsed === null) {
- Zend_Cache::throwException('Can\'t get filling percentage');
+ if ($mem === false) {
+ Zend_Cache::throwException('can\'t get stat from ' . $key);
+ } else {
+ $eachSize = $mem['limit_maxbytes'];
+ if ($eachSize == 0) {
+ Zend_Cache::throwException('can\'t get memory size from ' . $key);
+ }
+
+ $eachUsed = $mem['bytes'];
+ if ($eachUsed > $eachSize) {
+ $eachUsed = $eachSize;
+ }
+
+ $memSize += $eachSize;
+ $memUsed += $eachUsed;
+ }
}
return ((int) (100. * ($memUsed / $memSize)));
@@ -468,7 +466,7 @@ class Zend_Cache_Backend_Memcached extends Zend_Cache_Backend implements Zend_Ca
}
// #ZF-5702 : we try replace() first becase set() seems to be slower
if (!($result = $this->_memcache->replace($id, array($data, time(), $newLifetime), $flag, $newLifetime))) {
- $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime);
+ $result = $this->_memcache->set($id, array($data, time(), $newLifetime), $flag, $newLifetime);
}
return $result;
}
diff --git a/libs/Zend/Cache/Backend/Sqlite.php b/libs/Zend/Cache/Backend/Sqlite.php
index 3bb5ba91e3..7430d7303b 100644
--- a/libs/Zend/Cache/Backend/Sqlite.php
+++ b/libs/Zend/Cache/Backend/Sqlite.php
@@ -15,26 +15,26 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Sqlite.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Sqlite.php 17868 2009-08-28 09:46:30Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Sqlite extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
diff --git a/libs/Zend/Cache/Backend/Static.php b/libs/Zend/Cache/Backend/Static.php
deleted file mode 100644
index 19d83d5fd4..0000000000
--- a/libs/Zend/Cache/Backend/Static.php
+++ /dev/null
@@ -1,558 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Cache
- * @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: BlackHole.php 17867 2009-08-28 09:42:11Z yoshida@zend.co.jp $
- */
-
-/**
- * @see Zend_Cache_Backend_Interface
- */
-// require_once 'Zend/Cache/Backend/Interface.php';
-
-/**
- * @see Zend_Cache_Backend
- */
-// require_once 'Zend/Cache/Backend.php';
-
-/**
- * @package Zend_Cache
- * @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Cache_Backend_Static
- extends Zend_Cache_Backend
- implements Zend_Cache_Backend_Interface
-{
- const INNER_CACHE_NAME = 'zend_cache_backend_static_tagcache';
-
- /**
- * Static backend options
- * @var array
- */
- protected $_options = array(
- 'public_dir' => null,
- 'sub_dir' => 'html',
- 'file_extension' => '.html',
- 'index_filename' => 'index',
- 'file_locking' => true,
- 'cache_file_umask' => 0600,
- 'cache_directory_umask' => 0700,
- 'debug_header' => false,
- 'tag_cache' => null,
- 'disable_caching' => false
- );
-
- /**
- * Cache for handling tags
- * @var Zend_Cache_Core
- */
- protected $_tagCache = null;
-
- /**
- * Tagged items
- * @var array
- */
- protected $_tagged = null;
-
- /**
- * Interceptor child method to handle the case where an Inner
- * Cache object is being set since it's not supported by the
- * standard backend interface
- *
- * @param string $name
- * @param mixed $value
- * @return Zend_Cache_Backend_Static
- */
- public function setOption($name, $value)
- {
- if ($name == 'tag_cache') {
- $this->setInnerCache($value);
- } else {
- parent::setOption($name, $value);
- }
- return $this;
- }
-
- /**
- * Retrieve any option via interception of the parent's statically held
- * options including the local option for a tag cache.
- *
- * @param string $name
- * @return mixed
- */
- public function getOption($name)
- {
- if ($name == 'tag_cache') {
- return $this->getInnerCache();
- } else {
- if (in_array($name, $this->_options)) {
- return $this->_options[$name];
- }
- if ($name == 'lifetime') {
- return parent::getLifetime();
- }
- return null;
- }
- }
-
- /**
- * Test if a cache is available for the given id and (if yes) return it (false else)
- *
- * Note : return value is always "string" (unserialization is done by the core not by the backend)
- *
- * @param string $id Cache id
- * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
- * @return string|false cached datas
- */
- public function load($id, $doNotTestCacheValidity = false)
- {
- if (empty($id)) {
- $id = $this->_detectId();
- } else {
- $id = $this->_decodeId($id);
- }
- if (!$this->_verifyPath($id)) {
- Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
- }
- if ($doNotTestCacheValidity) {
- $this->_log("Zend_Cache_Backend_Static::load() : \$doNotTestCacheValidity=true is unsupported by the Static backend");
- }
-
- $fileName = basename($id);
- if (empty($fileName)) {
- $fileName = $this->_options['index_filename'];
- }
- $pathName = $this->_options['public_dir'] . dirname($id);
- $file = rtrim($pathName, '/') . '/' . $fileName . $this->_options['file_extension'];
- if (file_exists($file)) {
- $content = file_get_contents($file);
- return $content;
- }
-
- return false;
- }
-
- /**
- * Test if a cache is available or not (for the given id)
- *
- * @param string $id cache id
- * @return bool
- */
- public function test($id)
- {
- $id = $this->_decodeId($id);
- if (!$this->_verifyPath($id)) {
- Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
- }
-
- $fileName = basename($id);
- if (empty($fileName)) {
- $fileName = $this->_options['index_filename'];
- }
- if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
- $this->_tagged = $tagged;
- } elseif (!$this->_tagged) {
- return false;
- }
- $pathName = $this->_options['public_dir'] . dirname($id);
-
- // Switch extension if needed
- if (isset($this->_tagged[$id])) {
- $extension = $this->_tagged[$id]['extension'];
- } else {
- $extension = $this->_options['file_extension'];
- }
- $file = $pathName . '/' . $fileName . $extension;
- if (file_exists($file)) {
- return true;
- }
- return false;
- }
-
- /**
- * Save some string datas into a cache record
- *
- * Note : $data is always "string" (serialization is done by the
- * core not by the backend)
- *
- * @param string $data Datas to cache
- * @param string $id Cache id
- * @param array $tags Array of strings, the cache record will be tagged by each string entry
- * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime)
- * @return boolean true if no problem
- */
- public function save($data, $id, $tags = array(), $specificLifetime = false)
- {
- if ($this->_options['disable_caching']) {
- return true;
- }
- $extension = null;
- if ($this->_isSerialized($data)) {
- $data = unserialize($data);
- $extension = '.' . ltrim($data[1], '.');
- $data = $data[0];
- }
-
- clearstatcache();
- if (is_null($id) || strlen($id) == 0) {
- $id = $this->_detectId();
- } else {
- $id = $this->_decodeId($id);
- }
-
- $fileName = basename($id);
- if (empty($fileName)) {
- $fileName = $this->_options['index_filename'];
- }
-
- $pathName = realpath($this->_options['public_dir']) . dirname($id);
- $this->_createDirectoriesFor($pathName);
-
- if (is_null($id) || strlen($id) == 0) {
- $dataUnserialized = unserialize($data);
- $data = $dataUnserialized['data'];
- }
- $ext = $this->_options['file_extension'];
- if ($extension) $ext = $extension;
- $file = rtrim($pathName, '/') . '/' . $fileName . $ext;
- if ($this->_options['file_locking']) {
- $result = file_put_contents($file, $data, LOCK_EX);
- } else {
- $result = file_put_contents($file, $data);
- }
- @chmod($file, $this->_octdec($this->_options['cache_file_umask']));
-
- if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
- $this->_tagged = $tagged;
- } elseif (is_null($this->_tagged)) {
- $this->_tagged = array();
- }
- if (!isset($this->_tagged[$id])) {
- $this->_tagged[$id] = array();
- }
- if (!isset($this->_tagged[$id]['tags'])) {
- $this->_tagged[$id]['tags'] = array();
- }
- $this->_tagged[$id]['tags'] = array_unique(array_merge($this->_tagged[$id]['tags'], $tags));
- $this->_tagged[$id]['extension'] = $ext;
- $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
- return (bool) $result;
- }
-
- /**
- * Recursively create the directories needed to write the static file
- */
- protected function _createDirectoriesFor($path)
- {
- $parts = explode('/', $path);
- $directory = '';
- foreach ($parts as $part) {
- $directory = rtrim($directory, '/') . '/' . $part;
- if (!is_dir($directory)) {
- mkdir($directory, $this->_octdec($this->_options['cache_directory_umask']));
- }
- }
- }
-
- /**
- * Detect serialization of data (cannot predict since this is the only way
- * to obey the interface yet pass in another parameter).
- *
- * In future, ZF 2.0, check if we can just avoid the interface restraints.
- *
- * This format is the only valid one possible for the class, so it's simple
- * to just run a regular expression for the starting serialized format.
- */
- protected function _isSerialized($data)
- {
- return preg_match("/a:2:\{i:0;s:\d+:\"/", $data);
- }
-
- /**
- * Remove a cache record
- *
- * @param string $id Cache id
- * @return boolean True if no problem
- */
- public function remove($id)
- {
- if (!$this->_verifyPath($id)) {
- Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
- }
- $fileName = basename($id);
- if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
- $this->_tagged = $tagged;
- } elseif (!$this->_tagged) {
- return false;
- }
- if (isset($this->_tagged[$id])) {
- $extension = $this->_tagged[$id]['extension'];
- } else {
- $extension = $this->_options['file_extension'];
- }
- if (empty($fileName)) {
- $fileName = $this->_options['index_filename'];
- }
- $pathName = $this->_options['public_dir'] . dirname($id);
- $file = realpath($pathName) . '/' . $fileName . $extension;
- if (!file_exists($file)) {
- return false;
- }
- return unlink($file);
- }
-
- /**
- * Remove a cache record recursively for the given directory matching a
- * REQUEST_URI based relative path (deletes the actual file matching this
- * in addition to the matching directory)
- *
- * @param string $id Cache id
- * @return boolean True if no problem
- */
- public function removeRecursively($id)
- {
- if (!$this->_verifyPath($id)) {
- Zend_Cache::throwException('Invalid cache id: does not match expected public_dir path');
- }
- $fileName = basename($id);
- if (empty($fileName)) {
- $fileName = $this->_options['index_filename'];
- }
- $pathName = $this->_options['public_dir'] . dirname($id);
- $file = $pathName . '/' . $fileName . $this->_options['file_extension'];
- $directory = $pathName . '/' . $fileName;
- if (file_exists($directory)) {
- if (!is_writable($directory)) {
- return false;
- }
- foreach (new DirectoryIterator($directory) as $file) {
- if (true === $file->isFile()) {
- if (false === unlink($file->getPathName())) {
- return false;
- }
- }
- }
- rmdir(dirname($path));
- }
- if (file_exists($file)) {
- if (!is_writable($file)) {
- return false;
- }
- return unlink($file);
- }
- return true;
- }
-
- /**
- * Clean some cache records
- *
- * Available modes are :
- * Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used)
- * Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used)
- * Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags
- * ($tags can be an array of strings or a single string)
- * Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags}
- * ($tags can be an array of strings or a single string)
- * Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags
- * ($tags can be an array of strings or a single string)
- *
- * @param string $mode Clean mode
- * @param array $tags Array of tags
- * @return boolean true if no problem
- */
- public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
- {
- $result = false;
- switch ($mode) {
- case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
- case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
- if (empty($tags)) {
- throw new Zend_Exception('Cannot use tag matching modes as no tags were defined');
- }
- if (is_null($this->_tagged) && $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME)) {
- $this->_tagged = $tagged;
- } elseif (!$this->_tagged) {
- return true;
- }
- foreach ($tags as $tag) {
- $urls = array_keys($this->_tagged);
- foreach ($urls as $url) {
- if (isset($this->_tagged[$url]['tags']) && in_array($tag, $this->_tagged[$url]['tags'])) {
- $this->remove($url);
- unset($this->_tagged[$url]);
- }
- }
- }
- $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
- $result = true;
- break;
- case Zend_Cache::CLEANING_MODE_ALL:
- if (is_null($this->_tagged)) {
- $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME);
- $this->_tagged = $tagged;
- }
- if (is_null($this->_tagged) || empty($this->_tagged)) {
- return true;
- }
- $urls = array_keys($this->_tagged);
- foreach ($urls as $url) {
- $this->remove($url);
- unset($this->_tagged[$url]);
- }
- $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
- $result = true;
- break;
- case Zend_Cache::CLEANING_MODE_OLD:
- $this->_log("Zend_Cache_Backend_Static : Selected Cleaning Mode Currently Unsupported By This Backend");
- break;
- case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
- if (empty($tags)) {
- throw new Zend_Exception('Cannot use tag matching modes as no tags were defined');
- }
- if (is_null($this->_tagged)) {
- $tagged = $this->getInnerCache()->load(self::INNER_CACHE_NAME);
- $this->_tagged = $tagged;
- }
- if (is_null($this->_tagged) || empty($this->_tagged)) {
- return true;
- }
- $urls = array_keys($this->_tagged);
- foreach ($urls as $url) {
- $difference = array_diff($tags, $this->_tagged[$url]['tags']);
- if (count($tags) == count($difference)) {
- $this->remove($url);
- unset($this->_tagged[$url]);
- }
- }
- $this->getInnerCache()->save($this->_tagged, self::INNER_CACHE_NAME);
- $result = true;
- break;
- default:
- Zend_Cache::throwException('Invalid mode for clean() method');
- break;
- }
- return $result;
- }
-
- /**
- * Set an Inner Cache, used here primarily to store Tags associated
- * with caches created by this backend. Note: If Tags are lost, the cache
- * should be completely cleaned as the mapping of tags to caches will
- * have been irrevocably lost.
- *
- * @param Zend_Cache_Core
- * @return void
- */
- public function setInnerCache(Zend_Cache_Core $cache)
- {
- $this->_tagCache = $cache;
- $this->_options['tag_cache'] = $cache;
- }
-
- /**
- * Get the Inner Cache if set
- *
- * @return Zend_Cache_Core
- */
- public function getInnerCache()
- {
- if (is_null($this->_tagCache)) {
- Zend_Cache::throwException('An Inner Cache has not been set; use setInnerCache()');
- }
- return $this->_tagCache;
- }
-
- /**
- * Verify path exists and is non-empty
- *
- * @param string $path
- * @return bool
- */
- protected function _verifyPath($path)
- {
- $path = realpath($path);
- $base = realpath($this->_options['public_dir']);
- return strncmp($path, $base, strlen($base)) !== 0;
- }
-
- /**
- * Determine the page to save from the request
- *
- * @return string
- */
- protected function _detectId()
- {
- return $_SERVER['REQUEST_URI'];
- }
-
- /**
- * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)
- *
- * Throw an exception if a problem is found
- *
- * @param string $string Cache id or tag
- * @throws Zend_Cache_Exception
- * @return void
- * @deprecated Not usable until perhaps ZF 2.0
- */
- protected static function _validateIdOrTag($string)
- {
- if (!is_string($string)) {
- Zend_Cache::throwException('Invalid id or tag : must be a string');
- }
-
- // Internal only checked in Frontend - not here!
- if (substr($string, 0, 9) == 'internal-') {
- return;
- }
-
- // Validation assumes no query string, fragments or scheme included - only the path
- if (!preg_match(
- '/^(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*\'()\[\]:@&=+$,;])*)?)+$/',
- $string
- )
- ) {
- Zend_Cache::throwException("Invalid id or tag '$string' : must be a valid URL path");
- }
- }
-
- /**
- * Detect an octal string and return its octal value for file permission ops
- * otherwise return the non-string (assumed octal or decimal int already)
- *
- * @param $val The potential octal in need of conversion
- * @return int
- */
- protected function _octdec($val)
- {
- if (decoct(octdec($val)) == $val && is_string($val)) {
- return octdec($val);
- }
- return $val;
- }
-
- /**
- * Decode a request URI from the provided ID
- */
- protected function _decodeId($id)
- {
- return pack('H*', $id);;
- }
-}
diff --git a/libs/Zend/Cache/Backend/Test.php b/libs/Zend/Cache/Backend/Test.php
index f143ab4609..713b48954a 100644
--- a/libs/Zend/Cache/Backend/Test.php
+++ b/libs/Zend/Cache/Backend/Test.php
@@ -15,29 +15,29 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Test.php 21292 2010-03-02 10:25:22Z mabe $
+ * @version $Id: Test.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface
+class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
{
/**
* Available options
@@ -103,11 +103,7 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
public function load($id, $doNotTestCacheValidity = false)
{
$this->_addLog('get', array($id, $doNotTestCacheValidity));
- if ( $id == 'false'
- || $id == 'd8523b3ee441006261eeffa5c3d3a0a7'
- || $id == 'e83249ea22178277d5befc2c5e2e9ace'
- || $id == '40f649b94977c0a6e76902e2a0b43587')
- {
+ if ($id=='false') {
return false;
}
if ($id=='serialized') {
@@ -140,7 +136,10 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
if ($id=='false') {
return false;
}
- if (($id=='3c439c922209e2cb0b54d6deffccd75a')) {
+ if (($id=='d8523b3ee441006261eeffa5c3d3a0a7') or ($id=='3c439c922209e2cb0b54d6deffccd75a')) {
+ return false;
+ }
+ if (($id=='40f649b94977c0a6e76902e2a0b43587') or ($id=='e83249ea22178277d5befc2c5e2e9ace')) {
return false;
}
return 123456;
@@ -253,145 +252,6 @@ class Zend_Cache_Backend_Test extends Zend_Cache_Backend implements Zend_Cache_B
}
/**
- * Return an array of stored cache ids
- *
- * @return array array of stored cache ids (string)
- */
- public function getIds()
- {
- return array(
- 'prefix_id1', 'prefix_id2'
- );
- }
-
- /**
- * Return an array of stored tags
- *
- * @return array array of stored tags (string)
- */
- public function getTags()
- {
- return array(
- 'tag1', 'tag2'
- );
- }
-
- /**
- * Return an array of stored cache ids which match given tags
- *
- * In case of multiple tags, a logical AND is made between tags
- *
- * @param array $tags array of tags
- * @return array array of matching cache ids (string)
- */
- public function getIdsMatchingTags($tags = array())
- {
- if ($tags == array('tag1', 'tag2')) {
- return array('prefix_id1', 'prefix_id2');
- }
-
- return array();
- }
-
- /**
- * Return an array of stored cache ids which don't match given tags
- *
- * In case of multiple tags, a logical OR is made between tags
- *
- * @param array $tags array of tags
- * @return array array of not matching cache ids (string)
- */
- public function getIdsNotMatchingTags($tags = array())
- {
- if ($tags == array('tag3', 'tag4')) {
- return array('prefix_id3', 'prefix_id4');
- }
-
- return array();
- }
-
- /**
- * Return an array of stored cache ids which match any given tags
- *
- * In case of multiple tags, a logical AND is made between tags
- *
- * @param array $tags array of tags
- * @return array array of any matching cache ids (string)
- */
- public function getIdsMatchingAnyTags($tags = array())
- {
- if ($tags == array('tag5', 'tag6')) {
- return array('prefix_id5', 'prefix_id6');
- }
-
- return array();
- }
-
- /**
- * Return the filling percentage of the backend storage
- *
- * @return int integer between 0 and 100
- */
- public function getFillingPercentage()
- {
- return 50;
- }
-
- /**
- * Return an array of metadatas for the given cache id
- *
- * The array must include these keys :
- * - expire : the expire timestamp
- * - tags : a string array of tags
- * - mtime : timestamp of last modification time
- *
- * @param string $id cache id
- * @return array array of metadatas (false if the cache id is not found)
- */
- public function getMetadatas($id)
- {
- return false;
- }
-
- /**
- * Give (if possible) an extra lifetime to the given cache id
- *
- * @param string $id cache id
- * @param int $extraLifetime
- * @return boolean true if ok
- */
- public function touch($id, $extraLifetime)
- {
- return true;
- }
-
- /**
- * Return an associative array of capabilities (booleans) of the backend
- *
- * The array must include these keys :
- * - automatic_cleaning (is automating cleaning necessary)
- * - tags (are tags supported)
- * - expired_read (is it possible to read expired cache records
- * (for doNotTestCacheValidity option for example))
- * - priority does the backend deal with priority when saving
- * - infinite_lifetime (is infinite lifetime can work with this backend)
- * - get_list (is it possible to get the list of cache ids and the complete list of tags)
- *
- * @return array associative of with capabilities
- */
- public function getCapabilities()
- {
- return array(
- 'automatic_cleaning' => true,
- 'tags' => true,
- 'expired_read' => false,
- 'priority' => true,
- 'infinite_lifetime' => true,
- 'get_list' => true
- );
- }
-
- /**
* Add an event to the log array
*
* @param string $methodName MethodName
diff --git a/libs/Zend/Cache/Backend/TwoLevels.php b/libs/Zend/Cache/Backend/TwoLevels.php
index a537b739ca..b340645f6c 100644
--- a/libs/Zend/Cache/Backend/TwoLevels.php
+++ b/libs/Zend/Cache/Backend/TwoLevels.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: TwoLevels.php 21954 2010-04-19 19:19:24Z mabe $
+ * @version $Id: TwoLevels.php 17741 2009-08-22 02:58:33Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Cache_Backend_ExtendedInterface
*/
-// require_once 'Zend/Cache/Backend/ExtendedInterface.php';
+require_once 'Zend/Cache/Backend/ExtendedInterface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@@ -95,21 +95,21 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
*
* @var Zend_Cache_Backend
*/
- protected $_slowBackend;
+ private $_slowBackend;
/**
* Fast Backend
*
* @var Zend_Cache_Backend
*/
- protected $_fastBackend;
+ private $_fastBackend;
/**
* Cache for the fast backend filling percentage
*
* @var int
*/
- protected $_fastBackendFillingPercentage = null;
+ private $_fastBackendFillingPercentage = null;
/**
* Constructor
@@ -121,39 +121,20 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
public function __construct(array $options = array())
{
parent::__construct($options);
-
if ($this->_options['slow_backend'] === null) {
Zend_Cache::throwException('slow_backend option has to set');
- } elseif ($this->_options['slow_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
- $this->_slowBackend = $this->_options['slow_backend'];
- } else {
- $this->_slowBackend = Zend_Cache::_makeBackend(
- $this->_options['slow_backend'],
- $this->_options['slow_backend_options'],
- $this->_options['slow_backend_custom_naming'],
- $this->_options['slow_backend_autoload']
- );
- if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
- Zend_Cache::throwException('slow_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
- }
}
-
if ($this->_options['fast_backend'] === null) {
Zend_Cache::throwException('fast_backend option has to set');
- } elseif ($this->_options['fast_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
- $this->_fastBackend = $this->_options['fast_backend'];
- } else {
- $this->_fastBackend = Zend_Cache::_makeBackend(
- $this->_options['fast_backend'],
- $this->_options['fast_backend_options'],
- $this->_options['fast_backend_custom_naming'],
- $this->_options['fast_backend_autoload']
- );
- if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
- Zend_Cache::throwException('fast_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
- }
}
-
+ $this->_slowBackend = Zend_Cache::_makeBackend($this->_options['slow_backend'], $this->_options['slow_backend_options'], $this->_options['slow_backend_custom_naming'], $this->_options['slow_backend_autoload']);
+ $this->_fastBackend = Zend_Cache::_makeBackend($this->_options['fast_backend'], $this->_options['fast_backend_options'], $this->_options['fast_backend_custom_naming'], $this->_options['fast_backend_autoload']);
+ if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
+ Zend_Cache::throwException('slow_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
+ }
+ if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
+ Zend_Cache::throwException('fast_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
+ }
$this->_slowBackend->setDirectives($this->_directives);
$this->_fastBackend->setDirectives($this->_directives);
}
@@ -196,14 +177,8 @@ class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Ca
if (($priority > 0) && (10 * $priority >= $usage)) {
$fastLifetime = $this->_getFastLifetime($lifetime, $priority);
$boolFast = $this->_fastBackend->save($preparedData, $id, array(), $fastLifetime);
- $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
- } else {
- $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
- if ($boolSlow === true) {
- $boolFast = $this->_fastBackend->remove($id);
- }
}
-
+ $boolSlow = $this->_slowBackend->save($preparedData, $id, $tags, $lifetime);
return ($boolFast && $boolSlow);
}
diff --git a/libs/Zend/Cache/Backend/Xcache.php b/libs/Zend/Cache/Backend/Xcache.php
index ccd9672ca6..8f7af5963f 100644
--- a/libs/Zend/Cache/Backend/Xcache.php
+++ b/libs/Zend/Cache/Backend/Xcache.php
@@ -15,27 +15,27 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Xcache.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Xcache.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/**
* @see Zend_Cache_Backend
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
@@ -46,7 +46,7 @@ class Zend_Cache_Backend_Xcache extends Zend_Cache_Backend implements Zend_Cache
*/
const TAGS_UNSUPPORTED_BY_CLEAN_OF_XCACHE_BACKEND = 'Zend_Cache_Backend_Xcache::clean() : tags are unsupported by the Xcache backend';
const TAGS_UNSUPPORTED_BY_SAVE_OF_XCACHE_BACKEND = 'Zend_Cache_Backend_Xcache::save() : tags are unsupported by the Xcache backend';
-
+
/**
* Available options
*
diff --git a/libs/Zend/Cache/Backend/ZendPlatform.php b/libs/Zend/Cache/Backend/ZendPlatform.php
index 90b7c608c4..71bbdab3e0 100644
--- a/libs/Zend/Cache/Backend/ZendPlatform.php
+++ b/libs/Zend/Cache/Backend/ZendPlatform.php
@@ -15,20 +15,20 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ZendPlatform.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: ZendPlatform.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @see Zend_Cache_Backend_Interface
*/
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/**
@@ -36,7 +36,7 @@
*
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendPlatform extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/ZendServer.php b/libs/Zend/Cache/Backend/ZendServer.php
index f7a62f6276..55840efa43 100644
--- a/libs/Zend/Cache/Backend/ZendServer.php
+++ b/libs/Zend/Cache/Backend/ZendServer.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ZendServer.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: ZendServer.php 17672 2009-08-19 13:05:18Z yoshida@zend.co.jp $
*/
/** @see Zend_Cache_Backend_Interface */
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend */
-// require_once 'Zend/Cache/Backend.php';
+require_once 'Zend/Cache/Backend.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Cache_Backend_ZendServer extends Zend_Cache_Backend implements Zend_Cache_Backend_Interface
diff --git a/libs/Zend/Cache/Backend/ZendServer/Disk.php b/libs/Zend/Cache/Backend/ZendServer/Disk.php
index 49c604d005..ba0dd4b366 100644
--- a/libs/Zend/Cache/Backend/ZendServer/Disk.php
+++ b/libs/Zend/Cache/Backend/ZendServer/Disk.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Disk.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: Disk.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** @see Zend_Cache_Backend_Interface */
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend_ZendServer */
-// require_once 'Zend/Cache/Backend/ZendServer.php';
+require_once 'Zend/Cache/Backend/ZendServer.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface
@@ -50,7 +50,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
parent::__construct($options);
}
- /**
+ /**
* Store data
*
* @param mixed $data Object to store
@@ -60,13 +60,13 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _store($data, $id, $timeToLive)
{
- if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id,
- $data,
- $timeToLive) === false) {
+ if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id,
+ $data,
+ $timeToLive) === false) {
$this->_log('Store operation failed.');
return false;
- }
- return true;
+ }
+ return true;
}
/**
@@ -76,7 +76,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _fetch($id)
{
- return zend_disk_cache_fetch($this->_options['namespace'] . '::' . $id);
+ return zend_disk_cache_fetch($this->_options['namespace'] . '::' . $id);
}
/**
@@ -87,7 +87,7 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _unset($id)
{
- return zend_disk_cache_delete($this->_options['namespace'] . '::' . $id);
+ return zend_disk_cache_delete($this->_options['namespace'] . '::' . $id);
}
/**
@@ -95,6 +95,6 @@ class Zend_Cache_Backend_ZendServer_Disk extends Zend_Cache_Backend_ZendServer i
*/
protected function _clear()
{
- zend_disk_cache_clear($this->_options['namespace']);
+ zend_disk_cache_clear($this->_options['namespace']);
}
}
diff --git a/libs/Zend/Cache/Backend/ZendServer/ShMem.php b/libs/Zend/Cache/Backend/ZendServer/ShMem.php
index fd08df68bb..8e42eb60f1 100644
--- a/libs/Zend/Cache/Backend/ZendServer/ShMem.php
+++ b/libs/Zend/Cache/Backend/ZendServer/ShMem.php
@@ -15,23 +15,23 @@
* @category Zend
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: ShMem.php 20096 2010-01-06 02:05:09Z bkarwin $
+ * @version $Id: ShMem.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** @see Zend_Cache_Backend_Interface */
-// require_once 'Zend/Cache/Backend/Interface.php';
+require_once 'Zend/Cache/Backend/Interface.php';
/** @see Zend_Cache_Backend_ZendServer */
-// require_once 'Zend/Cache/Backend/ZendServer.php';
+require_once 'Zend/Cache/Backend/ZendServer.php';
/**
* @package Zend_Cache
* @subpackage Zend_Cache_Backend
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Cache_Backend_ZendServer_ShMem extends Zend_Cache_Backend_ZendServer implements Zend_Cache_Backend_Interface