public function Redis_Path_PhpRedis::lookupInHash in Redis 7.2
Same name and namespace in other branches
- 7.3 lib/Redis/Path/PhpRedis.php \Redis_Path_PhpRedis::lookupInHash()
2 calls to Redis_Path_PhpRedis::lookupInHash()
- Redis_Path_PhpRedis::lookupAlias in lib/
Redis/ Path/ PhpRedis.php - Lookup any alias for the given source
- Redis_Path_PhpRedis::lookupSource in lib/
Redis/ Path/ PhpRedis.php - Lookup any source for the given alias
File
- lib/
Redis/ Path/ PhpRedis.php, line 94
Class
- Redis_Path_PhpRedis
- PhpRedis implementation.
Code
public function lookupInHash($keyPrefix, $hkey, $language = null) {
$client = Redis_Client::getClient();
if (null === $language) {
$language = LANGUAGE_NONE;
$doNoneLookup = false;
}
else {
if (LANGUAGE_NONE === $language) {
$doNoneLookup = false;
}
else {
$doNoneLookup = true;
}
}
$ret = $client
->hget($this
->getKey($keyPrefix, $language), $hkey);
if ($doNoneLookup && (!$ret || self::VALUE_NULL === $ret)) {
$previous = $ret;
$ret = $client
->hget($this
->getKey($keyPrefix, LANGUAGE_NONE), $hkey);
if (!$ret && $previous) {
// Restore null placeholder else we loose conversion to false
// and drupal_lookup_path() would attempt saving it once again
$ret = $previous;
}
}
if (self::VALUE_NULL === $ret) {
return false;
// Needs conversion
}
if (empty($ret)) {
return null;
// Value not found
}
$existing = explode(self::VALUE_SEPARATOR, $ret);
return reset($existing);
}