Changeset 467 for branches/eli_branch/lib/Cache.inc.php
- Timestamp:
- Feb 19, 2014 2:28:00 AM (10 years ago)
- Location:
- branches/eli_branch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eli_branch
-
branches/eli_branch/lib/Cache.inc.php
r439 r467 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 31 31 * @since 2001 32 32 */ 33 33 34 34 // Flags. 35 35 define('CACHE_ALLOW_OVERSIZED', 1); … … 42 42 // Configuration parameters for this object. 43 43 private $_params = array( 44 44 45 45 // If false nothing will be cached or retrieved. Useful for testing realtime data requests. 46 46 'enabled' => true, … … 48 48 // The maximum size in bytes of any one variable. 49 49 'item_size_limit' => 4194304, // 4 MB 50 50 51 51 // The maximum size in bytes before the cache will begin flushing out old items. 52 52 'stack_size_limit' => 4194304, // 4 MB 53 53 54 54 // The minimum items to keep in the cache regardless of item or cache size. 55 55 'min_items' => 5, 56 56 ); 57 57 58 58 /* 59 59 * Constructor … … 68 68 { 69 69 $app =& App::getInstance(); 70 70 71 71 $this->_ns = $namespace; 72 72 … … 75 75 $this->setParam(array('enabled' => false)); 76 76 } 77 77 78 78 if (!isset($_SESSION['_cache'][$this->_ns])) { 79 79 $this->clear(); … … 127 127 { 128 128 $app =& App::getInstance(); 129 129 130 130 if (isset($this->_params[$param])) { 131 131 return $this->_params[$param]; … … 138 138 /** 139 139 * Stores a new variable in the session cache. The $key should not be numeric 140 * because the array_shift function will reset the key to the next largest 140 * because the array_shift function will reset the key to the next largest 141 141 * int key. Weird behavior I can't understand. For example $cache["123"] will become $cache[0] 142 142 * … … 168 168 $app->logMsg(sprintf('Serialized variable (%s bytes) more than stack_size_limit (%s bytes).', $var_len, $this->getParam('stack_size_limit')), LOG_NOTICE, __FILE__, __LINE__); 169 169 return false; 170 } 170 } 171 171 172 172 // Remove any value already stored under this key. … … 253 253 } 254 254 } 255 255 256 256 /* 257 257 * Delete all existing items from the cache.
Note: See TracChangeset
for help on using the changeset viewer.