public function select_fx($fx, $get_array = false)
{
$arr = array();
$prefix_length = strlen($this->prefix);
$keys = $this->redis->Keys($this->prefix . '*');
foreach ($keys as $key) {
$index = substr($key, $prefix_length);
$value = $this->read($index);
if (empty($value)) {
continue;
}
if ($fx($value, $index) === true) {
if (!$get_array) {
return $value;
} else {
$arr[$index] = $value;
}
}
}
if (!$get_array || empty($arr)) {
return false;
} else {
return $arr;
}
}