Cache fixes:
* We now cache negative lookups; clear them in Memcached_DataObject->insert() * Mark file.url as a unique key in statusnet.ini so its negative lookups are cleared properly (first save of a notice with a new URL was failing due to double-insert) * Now using serialization for default in-process cache instead of just saving objects; avoids potential corruption if you save an object to cache, change the original object, then fetch the same key from cache again
This commit is contained in:
parent
250bcfa8dc
commit
aff78e5121
@ -142,6 +142,7 @@ class Memcached_DataObject extends DB_DataObject
|
|||||||
|
|
||||||
function insert()
|
function insert()
|
||||||
{
|
{
|
||||||
|
$this->decache(); // in case of cached negative lookups
|
||||||
$result = parent::insert();
|
$result = parent::insert();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ modified = 384
|
|||||||
|
|
||||||
[file__keys]
|
[file__keys]
|
||||||
id = N
|
id = N
|
||||||
|
url = U
|
||||||
|
|
||||||
[file_oembed]
|
[file_oembed]
|
||||||
file_id = 129
|
file_id = 129
|
||||||
|
@ -120,7 +120,7 @@ class Cache
|
|||||||
|
|
||||||
if (Event::handle('StartCacheGet', array(&$key, &$value))) {
|
if (Event::handle('StartCacheGet', array(&$key, &$value))) {
|
||||||
if (array_key_exists($key, $this->_items)) {
|
if (array_key_exists($key, $this->_items)) {
|
||||||
$value = $this->_items[$key];
|
$value = unserialize($this->_items[$key]);
|
||||||
}
|
}
|
||||||
Event::handle('EndCacheGet', array($key, &$value));
|
Event::handle('EndCacheGet', array($key, &$value));
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ class Cache
|
|||||||
if (Event::handle('StartCacheSet', array(&$key, &$value, &$flag,
|
if (Event::handle('StartCacheSet', array(&$key, &$value, &$flag,
|
||||||
&$expiry, &$success))) {
|
&$expiry, &$success))) {
|
||||||
|
|
||||||
$this->_items[$key] = $value;
|
$this->_items[$key] = serialize($value);
|
||||||
|
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user