don't put Users with object IDs in the cache, and don't fetch them
This commit is contained in:
parent
30409f7bad
commit
9d3893255a
|
@ -171,7 +171,16 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
if (!$c) {
|
if (!$c) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
|
$obj = $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
|
||||||
|
if (0 == strcasecmp($cls, 'User')) {
|
||||||
|
// Special case for User
|
||||||
|
if (is_object($obj->id)) {
|
||||||
|
common_log(LOG_ERR, "User " . $obj->nickname . " was cached with User as ID; deleting");
|
||||||
|
$c->delete(Memcached_DataObject::cacheKey($cls, $k, $v));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +199,12 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
$c = $this->memcache();
|
$c = $this->memcache();
|
||||||
if (!$c) {
|
if (!$c) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if ($this->tableName() == 'user' && is_object($this->id)) {
|
||||||
|
// Special case for User bug
|
||||||
|
$e = new Exception();
|
||||||
|
common_log(LOG_ERR, __METHOD__ . ' caching user with User object as ID ' .
|
||||||
|
str_replace("\n", " ", $e->getTraceAsString()));
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$pkey = array();
|
$pkey = array();
|
||||||
$pval = array();
|
$pval = array();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user