redis:高级数据类型

一.Bitmaps  做信息状态统计的

获取指定key对应偏移量上的bit值 
getbit key offset
设置指定key对应偏移量上的bit值,value只能是1或0 
setbit key offset value
对指定key按位进行交、并、非、异或操作,并将结果保存到destKey中 
bitop op destKey key1 [key2...] 
and:交
or:并
not:非
xor:异或
统计指定key中1的数量 
bitcount key [start end]

二.HyperLogLog 做基数统计的 (基数:数据集去重后元素个数)

添加数据
pfadd key element [element ...]
统计数据 
pfcount key [key ...] 
合并数据 
pfmerge destkey sourcekey [sourcekey...] 

三.GEO 用于地理位置计算

添加坐标点
 geoadd key longitude latitude member [longitude latitude member ...] 
获取坐标点 
 geopos key member [member ...] 
计算坐标点距离 
 geodist key member1 member2 [unit] 
添加坐标点 
 georadius key longitude latitude radius m|km|ft|mi [withcoord] [withdist] [withhash] [count count] 
获取坐标点 
 georadiusbymember key member radius m|km|ft|mi [withcoord] [withdist] [withhash] [count count] 
计算经纬度 
 geohash key member [member ...] 

  

原文地址:https://www.cnblogs.com/wwjj4811/p/12750275.html