public function Redis_Path_Predis::lookupInHash in Redis 7.2
Same name and namespace in other branches
- 7.3 lib/Redis/Path/Predis.php \Redis_Path_Predis::lookupInHash()
2 calls to Redis_Path_Predis::lookupInHash()
- Redis_Path_Predis::lookupAlias in lib/
Redis/ Path/ Predis.php - Lookup any alias for the given source
- Redis_Path_Predis::lookupSource in lib/
Redis/ Path/ Predis.php - Lookup any source for the given alias
File
- lib/
Redis/ Path/ Predis.php, line 94
Class
- Redis_Path_Predis
- 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);
}