Merge pull request #4150 from nextcloud/capped-memcache-push

support pushing to CappedMemoryCache
This commit is contained in:
Joas Schilling 2017-03-30 15:16:33 +02:00 committed by GitHub
commit a51e4dd259
2 changed files with 7 additions and 2 deletions

View File

@ -47,7 +47,11 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
} }
public function set($key, $value, $ttl = 0) { public function set($key, $value, $ttl = 0) {
$this->cache[$key] = $value; if (is_null($key)) {
$this->cache[] = $value;
} else {
$this->cache[$key] = $value;
}
$this->garbageCollect(); $this->garbageCollect();
} }

View File

@ -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;
} }