equal
deleted
inserted
replaced
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 * @subpackage Zend_Cache_Backend |
17 * @subpackage Zend_Cache_Backend |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: TwoLevels.php 22736 2010-07-30 16:25:54Z andyfowler $ |
20 * @version $Id: TwoLevels.php 24593 2012-01-05 20:35:02Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 |
23 |
24 /** |
24 /** |
25 * @see Zend_Cache_Backend_ExtendedInterface |
25 * @see Zend_Cache_Backend_ExtendedInterface |
33 |
33 |
34 |
34 |
35 /** |
35 /** |
36 * @package Zend_Cache |
36 * @package Zend_Cache |
37 * @subpackage Zend_Cache_Backend |
37 * @subpackage Zend_Cache_Backend |
38 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
38 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
39 * @license http://framework.zend.com/license/new-bsd New BSD License |
39 * @license http://framework.zend.com/license/new-bsd New BSD License |
40 */ |
40 */ |
41 |
41 |
42 class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface |
42 class Zend_Cache_Backend_TwoLevels extends Zend_Cache_Backend implements Zend_Cache_Backend_ExtendedInterface |
43 { |
43 { |
381 public function getIdsMatchingAnyTags($tags = array()) |
381 public function getIdsMatchingAnyTags($tags = array()) |
382 { |
382 { |
383 return $this->_slowBackend->getIdsMatchingAnyTags($tags); |
383 return $this->_slowBackend->getIdsMatchingAnyTags($tags); |
384 } |
384 } |
385 |
385 |
386 |
|
387 /** |
386 /** |
388 * Return the filling percentage of the backend storage |
387 * Return the filling percentage of the backend storage |
389 * |
388 * |
390 * @return int integer between 0 and 100 |
389 * @return int integer between 0 and 100 |
391 */ |
390 */ |
479 * @param int $maxLifetime maximum lifetime |
478 * @param int $maxLifetime maximum lifetime |
480 * @return int lifetime for the fast backend |
479 * @return int lifetime for the fast backend |
481 */ |
480 */ |
482 private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) |
481 private function _getFastLifetime($lifetime, $priority, $maxLifetime = null) |
483 { |
482 { |
484 if ($lifetime === null) { |
483 if ($lifetime <= 0) { |
485 // if lifetime is null, we have an infinite lifetime |
484 // if no lifetime, we have an infinite lifetime |
486 // we need to use arbitrary lifetimes |
485 // we need to use arbitrary lifetimes |
487 $fastLifetime = (int) (2592000 / (11 - $priority)); |
486 $fastLifetime = (int) (2592000 / (11 - $priority)); |
488 } else { |
487 } else { |
489 $fastLifetime = (int) ($lifetime / (11 - $priority)); |
488 // prevent computed infinite lifetime (0) by ceil |
490 } |
489 $fastLifetime = (int) ceil($lifetime / (11 - $priority)); |
491 if (($maxLifetime !== null) && ($maxLifetime >= 0)) { |
490 } |
492 if ($fastLifetime > $maxLifetime) { |
491 |
493 return $maxLifetime; |
492 if ($maxLifetime >= 0 && $fastLifetime > $maxLifetime) { |
494 } |
493 return $maxLifetime; |
495 } |
494 } |
|
495 |
496 return $fastLifetime; |
496 return $fastLifetime; |
497 } |
497 } |
498 |
498 |
499 /** |
499 /** |
500 * PUBLIC METHOD FOR UNIT TESTING ONLY ! |
500 * PUBLIC METHOD FOR UNIT TESTING ONLY ! |