[CORE][Cache] Allow retrieving multiple keys from a hashmap

This commit is contained in:
Hugo Sales 2021-11-15 17:07:32 +00:00
parent 587d701d11
commit e6c0db9ee1
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -318,10 +318,14 @@ abstract class Cache
} }
} }
public static function getHashMapKey(string $map_key, string $key, string $pool = 'default') public static function getHashMapKey(string $map_key, string|array $key, string $pool = 'default')
{ {
if (isset(self::$redis[$pool])) { if (isset(self::$redis[$pool])) {
if (\is_string($key)) {
return self::$redis[$pool]->hget($map_key, $key); return self::$redis[$pool]->hget($map_key, $key);
} else {
return self::$redis[$pool]->hmget($map_key, $key);
}
} else { } else {
throw new NotImplementedException; throw new NotImplementedException;
} }