mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +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) {
|
||||
$this->con->set((string) $key, $expire, $this->build($value));
|
||||
$this->con->set((string) $key, $this->build($value), $expire);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -247,17 +247,19 @@ final class RedisCache extends ConnectionAbstract
|
|||
$values = [];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (\preg_match('/' . $pattern . '/', $key) === 1) {
|
||||
$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;
|
||||
if (\preg_match('/' . $pattern . '/', $key) !== 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$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;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
|
|||
$this->cache->set('key2', 'testVal2', 2);
|
||||
\sleep(1);
|
||||
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);
|
||||
self::assertEquals([], $this->cache->getLike('key\d'));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user