better deletes and key names
darcs-hash:20080926163030-5ed1f-c2d375d8a8c2097456ffb3e09e55daacae2cc903.gz
This commit is contained in:
parent
156207d58d
commit
88b19d8ab5
|
@ -71,9 +71,7 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function cacheKey($cls, $k, $v) {
|
static function cacheKey($cls, $k, $v) {
|
||||||
return common_cache_key(strtolower($cls) . ':' .
|
return common_cache_key(strtolower($cls).':'.$k.':'.$v);
|
||||||
$k . ':' .
|
|
||||||
$v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getcached($cls, $k, $v) {
|
static function getcached($cls, $k, $v) {
|
||||||
|
@ -100,7 +98,8 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$primary = array();
|
$primary = array();
|
||||||
$types = ksort($this->keyTypes());
|
$types = $this->keyTypes();
|
||||||
|
ksort($types);
|
||||||
foreach ($types as $key => $type) {
|
foreach ($types as $key => $type) {
|
||||||
if ($type == 'K') {
|
if ($type == 'K') {
|
||||||
$primary[] = $key;
|
$primary[] = $key;
|
||||||
|
@ -124,20 +123,19 @@ class Memcached_DataObject extends DB_DataObject
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$primary = array();
|
$primary = array();
|
||||||
$types = ksort($this->keyTypes());
|
$types = $this->keyTypes();
|
||||||
|
ksort($types);
|
||||||
foreach ($types as $key => $type) {
|
foreach ($types as $key => $type) {
|
||||||
if ($type == 'K') {
|
if ($type == 'K') {
|
||||||
$primary[] = $this->$key;
|
$primary[] = $this->$key;
|
||||||
} else {
|
} else {
|
||||||
$c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
|
$c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
|
||||||
$this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# XXX: figure out what to do with compound pkeys
|
# XXX: figure out what to do with compound pkeys
|
||||||
if (count($primary) == 1) {
|
if (count($primary) == 1) {
|
||||||
$key = $primary[0];
|
$key = $primary[0];
|
||||||
$c->delete($this->cacheKey($this->tableName(), $key, $this->$key),
|
$c->delete($this->cacheKey($this->tableName(), $key, $this->$key));
|
||||||
$this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user