mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 13:38:41 +00:00
cache fixes
This commit is contained in:
parent
4b8475f890
commit
991d7d2b80
|
|
@ -113,7 +113,7 @@ final class RedisCache extends ConnectionAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($expire > 0) {
|
if ($expire > 0) {
|
||||||
$this->con->set((string) $key, $expire, $this->build($value));
|
$this->con->set((string) $key, $this->build($value), $expire);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -247,17 +247,19 @@ final class RedisCache extends ConnectionAbstract
|
||||||
$values = [];
|
$values = [];
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
if (\preg_match('/' . $pattern . '/', $key) === 1) {
|
if (\preg_match('/' . $pattern . '/', $key) !== 1) {
|
||||||
$result = $this->con->get((string) $key);
|
continue;
|
||||||
if (\is_string($result) && ($result[0] ?? null) === self::DELIM) {
|
|
||||||
$result = \substr($result, 1);
|
|
||||||
$type = (int) $result[0];
|
|
||||||
$start = (int) \strpos($result, self::DELIM);
|
|
||||||
$result = $this->reverseValue($type, $result, $start);
|
|
||||||
}
|
|
||||||
|
|
||||||
$values[] = $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = $this->con->get((string) $key);
|
||||||
|
if (\is_string($result) && ($result[0] ?? null) === self::DELIM) {
|
||||||
|
$result = \substr($result, 1);
|
||||||
|
$type = (int) $result[0];
|
||||||
|
$start = (int) \strpos($result, self::DELIM);
|
||||||
|
$result = $this->reverseValue($type, $result, $start);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values[] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->cache->set('key2', 'testVal2', 2);
|
$this->cache->set('key2', 'testVal2', 2);
|
||||||
\sleep(1);
|
\sleep(1);
|
||||||
self::assertEquals([], \array_diff(['testVal1', 'testVal2'], $this->cache->getLike('key\d')));
|
self::assertEquals([], \array_diff(['testVal1', 'testVal2'], $this->cache->getLike('key\d')));
|
||||||
self::assertEquals([], \array_diff(['testVal1', 'testVal2'], $this->cache->getLike('key\d', 0)));
|
self::assertEquals([], \array_diff(['testVal1', 'testVal2'], $this->cache->getLike('key\d', 0)));
|
||||||
\sleep(3);
|
\sleep(3);
|
||||||
self::assertEquals([], $this->cache->getLike('key\d'));
|
self::assertEquals([], $this->cache->getLike('key\d'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user