diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-05 12:44:18 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-05 12:44:18 -0400 |
commit | d4db9d83d84859d7492438a215c8d7a4baf3ef68 (patch) | |
tree | 88193171d469a10accb3e878c59e9dd56930c85a /classes/Memcached_DataObject.php | |
parent | e21d2cfdb5f259a07d7af0e3c7f5421315ed2710 (diff) |
Revert "Merge branch '0.8.x' into cachenonexistent"
This reverts commit e21d2cfdb5f259a07d7af0e3c7f5421315ed2710.
Diffstat (limited to 'classes/Memcached_DataObject.php')
-rw-r--r-- | classes/Memcached_DataObject.php | 50 |
1 files changed, 10 insertions, 40 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 96f8d520b..f7cbb9d5b 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -33,41 +33,21 @@ class Memcached_DataObject extends DB_DataObject $k = $keys[0]; unset($i); } - $i = self::getcached($cls, $k, $v); + $i = Memcached_DataObject::getcached($cls, $k, $v); if ($i) { return $i; } else { $i = DB_DataObject::staticGet($cls, $k, $v); if ($i) { $i->encache(); - } else { - self::cachenull($cls, $k, $v); } return $i; } } - function cachenull($cls, $k, $v) - { - $c = self::memcache(); - if (empty($c)) { - return; - } - $c->set(self::cacheKey($cls, $k, $v), null); - } - - function multicachenull($cls, $kv) - { - $c = self::memcache(); - if (empty($c)) { - return; - } - $c->set(self::multicachekey($cls, $kv), null); - } - function &pkeyGet($cls, $kv) { - $i = self::multicache($cls, $kv); + $i = Memcached_DataObject::multicache($cls, $kv); if ($i) { return $i; } else { @@ -78,7 +58,6 @@ class Memcached_DataObject extends DB_DataObject if ($i->find(true)) { $i->encache(); } else { - self::multicachenull($cls, $kv); $i = null; } return $i; @@ -88,9 +67,6 @@ class Memcached_DataObject extends DB_DataObject function insert() { $result = parent::insert(); - if ($result) { - $this->encache(); - } return $result; } @@ -121,11 +97,11 @@ class Memcached_DataObject extends DB_DataObject } static function getcached($cls, $k, $v) { - $c = self::memcache(); + $c = Memcached_DataObject::memcache(); if (!$c) { return false; } else { - return $c->get(self::cacheKey($cls, $k, $v)); + return $c->get(Memcached_DataObject::cacheKey($cls, $k, $v)); } } @@ -192,23 +168,17 @@ class Memcached_DataObject extends DB_DataObject function multicache($cls, $kv) { - $c = self::memcache(); + ksort($kv); + $c = Memcached_DataObject::memcache(); if (!$c) { return false; } else { - return $c->get(self::multicachekey($cls, $kv)); + $pkeys = implode(',', array_keys($kv)); + $pvals = implode(',', array_values($kv)); + return $c->get(Memcached_DataObject::cacheKey($cls, $pkeys, $pvals)); } } - function multicachekey($cls, $kv) - { - ksort($kv); - $pkeys = implode(',', array_keys($kv)); - $pvals = implode(',', array_values($kv)); - - return self::cacheKey($cls, $pkeys, $pvals); - } - function getSearchEngine($table) { require_once INSTALLDIR.'/lib/search_engines.php'; @@ -241,7 +211,7 @@ class Memcached_DataObject extends DB_DataObject static function cachedQuery($cls, $qry, $expiry=3600) { - $c = self::memcache(); + $c = Memcached_DataObject::memcache(); if (!$c) { $inst = new $cls(); $inst->query($qry); |