fix default array implementation checks

This commit is contained in:
Evan Prodromou 2010-01-02 20:32:56 -10:00
parent c5d23e27a6
commit e1de1bf0fe

View File

@ -71,9 +71,9 @@ class Cache
$value = null; $value = null;
if (!Event::handle('StartCacheGet', array(&$key, &$value))) { if (!Event::handle('StartCacheGet', array(&$key, &$value))) {
if (array_key_exists($_items, $key)) { if (array_key_exists($key, $this->_items)) {
common_log(LOG_INFO, 'Cache HIT for key ' . $key); common_log(LOG_INFO, 'Cache HIT for key ' . $key);
$value = $_items[$key]; $value = $this->_items[$key];
} else { } else {
common_log(LOG_INFO, 'Cache MISS for key ' . $key); common_log(LOG_INFO, 'Cache MISS for key ' . $key);
} }
@ -89,7 +89,7 @@ class Cache
if (!Event::handle('StartCacheSet', array(&$key, &$value, &$flag, &$expiry, &$success))) { if (!Event::handle('StartCacheSet', array(&$key, &$value, &$flag, &$expiry, &$success))) {
common_log(LOG_INFO, 'Setting cache value for key ' . $key); common_log(LOG_INFO, 'Setting cache value for key ' . $key);
$_items[$key] = $value; $this->_items[$key] = $value;
$success = true; $success = true;
Event::handle('EndCacheSet', array($key, $value, $flag, $expiry)); Event::handle('EndCacheSet', array($key, $value, $flag, $expiry));
} }
@ -102,8 +102,10 @@ class Cache
$success = false; $success = false;
if (!Event::handle('StartCacheDelete', array(&$key, &$success))) { if (!Event::handle('StartCacheDelete', array(&$key, &$success))) {
if (array_key_exists($key, $this->_items[$key])) {
common_log(LOG_INFO, 'Deleting cache value for key ' . $key); common_log(LOG_INFO, 'Deleting cache value for key ' . $key);
unset($_items[$key]); unset($this->_items[$key]);
}
$success = true; $success = true;
Event::handle('EndCacheDelete', array($key)); Event::handle('EndCacheDelete', array($key));
} }