]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better deletes and key names
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 16:30:30 +0000 (12:30 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 26 Sep 2008 16:30:30 +0000 (12:30 -0400)
darcs-hash:20080926163030-5ed1f-c2d375d8a8c2097456ffb3e09e55daacae2cc903.gz

classes/Memcached_DataObject.php

index 12e55af21f25c0bebd28a013288ebb729f8a6b7b..ab56d2474e08376b81072fcac47fc5fca7d5879e 100644 (file)
@@ -71,9 +71,7 @@ class Memcached_DataObject extends DB_DataObject
        }
        
        static function cacheKey($cls, $k, $v) {
-               return common_cache_key(strtolower($cls) . ':' .
-                                                               $k . ':' .
-                                                               $v);
+               return common_cache_key(strtolower($cls).':'.$k.':'.$v);
        }
        
        static function getcached($cls, $k, $v) {
@@ -100,7 +98,8 @@ class Memcached_DataObject extends DB_DataObject
                        return false;
                } else {
                        $primary = array();
-                       $types = ksort($this->keyTypes());
+                       $types = $this->keyTypes();
+                       ksort($types);
                        foreach ($types as $key => $type) {
                                if ($type == 'K') {
                                        $primary[] = $key;
@@ -124,20 +123,19 @@ class Memcached_DataObject extends DB_DataObject
                        return false;
                } else {
                        $primary = array();
-                       $types = ksort($this->keyTypes());
+                       $types = $this->keyTypes();
+                       ksort($types);
                        foreach ($types as $key => $type) {
                                if ($type == 'K') {
                                        $primary[] = $this->$key;
                                } else {
-                                       $c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
-                                                          $this);
+                                       $c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
                                }
                        }
                        # XXX: figure out what to do with compound pkeys
                        if (count($primary) == 1) {
                                $key = $primary[0];
-                               $c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
-                                                  $this);
+                               $c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
                        }
                }
        }