Cache: try to set the fast cache in the Broker
This commit is contained in:
parent
fe0f281b4f
commit
c6b9f613bb
1 changed files with 3 additions and 5 deletions
8
lib/cache/broker.php
vendored
8
lib/cache/broker.php
vendored
|
@ -23,15 +23,13 @@ class OC_Cache_Broker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set($key, $value, $ttl=0) {
|
public function set($key, $value, $ttl=0) {
|
||||||
$set_slow = strlen($value) > 8192;
|
if (!$this->fast_cache->set($key, $value, $ttl)) {
|
||||||
if ($set_slow) {
|
|
||||||
if ($this->fast_cache->hasKey($key)) {
|
if ($this->fast_cache->hasKey($key)) {
|
||||||
$this->fast_cache->remove($key);
|
$this->fast_cache->remove($key);
|
||||||
}
|
}
|
||||||
$this->slow_cache->set($key, $value, $ttl);
|
return $this->slow_cache->set($key, $value, $ttl);
|
||||||
} else {
|
|
||||||
$this->fast_cache->set($key, $value, $ttl);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasKey($key) {
|
public function hasKey($key) {
|
||||||
|
|
Loading…
Reference in a new issue