Call memcache() as a static object (it's a static class)
This commit is contained in:
parent
a38ed0057a
commit
a980f4ed33
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
|
|
||||||
class Memcached_DataObject extends Safe_DataObject
|
class Memcached_DataObject extends Safe_DataObject
|
||||||
{
|
{
|
||||||
|
@ -350,7 +350,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
*/
|
*/
|
||||||
static function pkeyGetClass($cls, array $kv)
|
static function pkeyGetClass($cls, array $kv)
|
||||||
{
|
{
|
||||||
$i = Memcached_DataObject::multicache($cls, $kv);
|
$i = self::multicache($cls, $kv);
|
||||||
if ($i !== false) { // false == cache miss
|
if ($i !== false) { // false == cache miss
|
||||||
return $i;
|
return $i;
|
||||||
} else {
|
} else {
|
||||||
|
@ -422,16 +422,16 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getcached($cls, $k, $v) {
|
static function getcached($cls, $k, $v) {
|
||||||
$c = Memcached_DataObject::memcache();
|
$c = self::memcache();
|
||||||
if (!$c) {
|
if (!$c) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$obj = $c->get(Memcached_DataObject::cacheKey($cls, $k, $v));
|
$obj = $c->get(self::cacheKey($cls, $k, $v));
|
||||||
if (0 == strcasecmp($cls, 'User')) {
|
if (0 == strcasecmp($cls, 'User')) {
|
||||||
// Special case for User
|
// Special case for User
|
||||||
if (is_object($obj) && is_object($obj->id)) {
|
if (is_object($obj) && is_object($obj->id)) {
|
||||||
common_log(LOG_ERR, "User " . $obj->nickname . " was cached with User as ID; deleting");
|
common_log(LOG_ERR, "User " . $obj->nickname . " was cached with User as ID; deleting");
|
||||||
$c->delete(Memcached_DataObject::cacheKey($cls, $k, $v));
|
$c->delete(self::cacheKey($cls, $k, $v));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
|
|
||||||
function encache()
|
function encache()
|
||||||
{
|
{
|
||||||
$c = $this->memcache();
|
$c = self::memcache();
|
||||||
|
|
||||||
if (!$c) {
|
if (!$c) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -483,7 +483,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
|
|
||||||
function decache()
|
function decache()
|
||||||
{
|
{
|
||||||
$c = $this->memcache();
|
$c = self::memcache();
|
||||||
|
|
||||||
if (!$c) {
|
if (!$c) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -514,7 +514,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
if (empty($this->$key)) {
|
if (empty($this->$key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$ckeys[] = $this->cacheKey($this->tableName(), $key, self::valueString($this->$key));
|
$ckeys[] = self::cacheKey($this->tableName(), $key, self::valueString($this->$key));
|
||||||
} else if ($type == 'K' || $type == 'N') {
|
} else if ($type == 'K' || $type == 'N') {
|
||||||
$pkey[] = $key;
|
$pkey[] = $key;
|
||||||
$pval[] = self::valueString($this->$key);
|
$pval[] = self::valueString($this->$key);
|
||||||
|
@ -530,7 +530,7 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
$pvals = implode(',', $pval);
|
$pvals = implode(',', $pval);
|
||||||
$pkeys = implode(',', $pkey);
|
$pkeys = implode(',', $pkey);
|
||||||
|
|
||||||
$ckeys[] = $this->cacheKey($this->tableName(), $pkeys, $pvals);
|
$ckeys[] = self::cacheKey($this->tableName(), $pkeys, $pvals);
|
||||||
|
|
||||||
return $ckeys;
|
return $ckeys;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user