We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于set方法,我测试了下$redis->set('test',13.6);取出来正常的?redis版本3.0.7
$redis->set('test',13.6);
3.0.7
/** * 存储一个键值 * @param string or int $key 键名 * @param mix $value 键值,支持数组、对象 * @param int $expire 过期时间(秒) * @return bool 返回布尔值 */ public static function set($key, $value, $expire='') { if(is_int($key) || is_string($key)){ //如果是int类型的数字就不要序列化,否则用自增自减功能会失败, //如果不序列化,set()方法只能保存字符串和数字类型, //如果不序列化,浮点型数字会有失误,如13.6保存,获取时是13.59999999999 $value = is_int($value) ? $value : serialize($value); $expire = (int)$expire ? $expire : self::$expire; if(self::$redis->set($key, $value) && self::$redis->expire($key, $expire)){ return true; } return false; } return false; }
还有 sadd支持数组,不用循环sadd
The text was updated successfully, but these errors were encountered:
No branches or pull requests
关于set方法,我测试了下
$redis->set('test',13.6);
取出来正常的?redis版本3.0.7
还有 sadd支持数组,不用循环sadd
The text was updated successfully, but these errors were encountered: