Merge pull request #4150 from nextcloud/capped-memcache-push
support pushing to CappedMemoryCache
This commit is contained in:
commit
a51e4dd259
|
@ -47,7 +47,11 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set($key, $value, $ttl = 0) {
|
public function set($key, $value, $ttl = 0) {
|
||||||
|
if (is_null($key)) {
|
||||||
|
$this->cache[] = $value;
|
||||||
|
} else {
|
||||||
$this->cache[$key] = $value;
|
$this->cache[$key] = $value;
|
||||||
|
}
|
||||||
$this->garbageCollect();
|
$this->garbageCollect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,9 +237,10 @@ class Database extends Backend implements IUserBackend {
|
||||||
* @return boolean true if user was found, false otherwise
|
* @return boolean true if user was found, false otherwise
|
||||||
*/
|
*/
|
||||||
private function loadUser($uid) {
|
private function loadUser($uid) {
|
||||||
|
$uid = (string) $uid;
|
||||||
if (!isset($this->cache[$uid])) {
|
if (!isset($this->cache[$uid])) {
|
||||||
//guests $uid could be NULL or ''
|
//guests $uid could be NULL or ''
|
||||||
if ($uid === null || $uid === '') {
|
if ($uid === '') {
|
||||||
$this->cache[$uid]=false;
|
$this->cache[$uid]=false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue