Changeset 1164 for trunk/common/cache.php
- Timestamp:
- 01/14/12 16:18:10 (4 months ago)
- File:
-
- 1 edited
-
trunk/common/cache.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/cache.php
r966 r1164 144 144 // mem_cache_purge deletes everything from the cache. Try to avoid calling it. 145 145 // 146 // FIXME: cache is not logged. See IA_LOG_MEM_CACHE.147 146 if (IA_MEM_CACHE_METHOD == 'none') { 148 147 … … 259 258 } 260 259 } 260 261 } else if (IA_MEM_CACHE_METHOD == 'apc') { 262 // APC cache implementation 263 function mem_cache_get($cache_id) { 264 $res = apc_fetch($cache_id); 265 if ($res === false) { 266 if (IA_LOG_MEM_CACHE) { 267 log_print("MEM CACHE: miss on $cache_id"); 268 } 269 return false; 270 } else { 271 if (IA_LOG_MEM_CACHE) { 272 log_print("MEM CACHE: hit on $cache_id"); 273 } 274 return unserialize($res); 275 } 276 } 277 278 function mem_cache_set($cache_id, $object, $ttl = IA_MEM_CACHE_EXPIRATION) { 279 log_assert($object !== 'false', "Can't cache false values"); 280 apc_store($cache_id, serialize($object), $ttl); 281 282 if (IA_LOG_MEM_CACHE) { 283 log_print("MEM CACHE: store $cache_id"); 284 } 285 return $object; 286 } 287 288 function mem_cache_delete($cache_id) { 289 apc_delete($cache_id); 290 if (IA_LOG_MEM_CACHE) { 291 log_print("MEM CACHE: delete $cache_id"); 292 } 293 } 294 295 function mem_cache_purge() { 296 if (IA_LOG_MEM_CACHE) { 297 log_print("MEM CACHE: purge"); 298 } 299 apc_clear_cache(); 300 } 261 301 } 262 302
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)