Redis三种特殊数据类型之geospatial、Hyperloglog、Bitmaps

Redis学习笔记3:五大数据类型(String、List、Set、Hash、Zset)和三种特殊数据类型(geospatial、Hyperloglog、Bitmaps) 介绍: Redis是一个开源(BSD许可)的,内存中的数据结构存储系统,它可以用作数据库、缓存和消息中间件MQ,它支持多种类型的数据结构,如字符串( strings ) ,散列(hashes ) ,列表( lists ) ,集合(sets ) ,有序集合(sorted sets)与范围查询,bitmaps, hyperloglogs和地理空间( geospatial )索引半径查询. Redis内置了复制( replication ) , LUA脚本(Lua scripting ) , L... 阅读详情

三种特殊数据类型

geospatial 地理位置

可以干什么

朋友的定位、附近的人、打车距离计算
辅助查询经纬度测试数据:http://www.daquan.la/jingwei/

只有六个命令

官方文档:https://www.redis.net.cn/order/3685.html
在这里插入图片描述

  • geoadd:添加一个(多个)地理位置

规则:两级无法直接添加,一般下载测试数据,java一次性导入
参数:key 值(经度(-180~180)、纬度(-85.05112878 ~ 85.05112878)、名称)

127.0.0.1:6379[6]> geoadd china:city 115.95 25.55 nanchang
(integer) 1
127.0.0.1:6379[6]> geoadd china:city 121.47 31.23 shanghai
(integer) 1
127.0.0.1:6379[6]> geoadd china:city 116.33 39.89 beijin
(integer) 1
127.0.0.1:6379[6]> geoadd china:city 106.50 29.53 chongqing 114.05 22.52 shenzhen
(integer) 2
127.0.0.1:6379[6]> geoadd china:city 120.16 30.24 hangzhou
(integer) 1
127.0.0.1:6379[6]> 
  • peopos:获取指定的一个(多个)经度和纬度

获得当前定位:一定是一个坐标值!

127.0.0.1:6379[6]> geopos china:city beijin chongqing
1) 1) "116.3299986720085144"
   2) "39.89000061669732844"
2) 1) "106.49999767541885376"
   2) "29.52999957900659211"
  • geodist:两个城市之间距离(好友之间距离)

m 表示单位为米。
km 表示单位为千米。
mi 表示单位为英里。
ft 表示单位为英尺。

127.0.0.1:6379[6]> geodist china:city beijin shanghai
"1069113.1187"
127.0.0.1:6379[6]> geodist china:city beijin shanghai km
"1069.1131"
127.0.0.1:6379[6]> geodist china:city beijin nanchang km
"1595.3768"
  • georadius:以给定的经纬度为中心,找出某一半径内的元素(附近的人)

找附近的人?(获得附近的人地址,定位),通过半径查询
获得指定数量
所有数据都录入china:city,才会让结果更精确

#获取110 30经纬度为中心方圆1000km内的城市
127.0.0.1:6379[6]> georadius china:city 110 30 1000 km
1) "chongqing"
2) "shenzhen"
3) "nanchang"
4) "hangzhou"
127.0.0.1:6379[6]> georadius china:city 110 30 500 km
1) "chongqing"
#显示到中心距离的位置
127.0.0.1:6379[6]> georadius china:city 110 30 500 km withdist
1) 1) "chongqing"
   2) "341.9374"
 #显示他人的定位信息
127.0.0.1:6379[6]> georadius china:city 110 30 500 km withcoord
1) 1) "chongqing"
   2) 1) "106.49999767541885376"
      2) "29.52999957900659211"
 #筛选出指定结果
127.0.0.1:6379[6]> georadius china:city 110 30 500 km withdist withcoord count 1
1) 1) "chongqing"
   2) "341.9374"
   3) 1) "106.49999767541885376"
      2) "29.52999957900659211"
  • georadiusbymember:找出位于指定元素周围的其他元素
#位于 beijing 1000km的其他元素
127.0.0.1:6379[6]> georadiusbymember china:city beijin 1000 km
1) "beijin"
127.0.0.1:6379[6]> georadiusbymember china:city shanghai 400 km
1) "hangzhou"
2) "shanghai"
  • geohash:返回一个(多个)位置元素的geohash表示
    返回11个字符的geohash字符串!
    两个字符串越接近,距离越近
127.0.0.1:6379[6]> geohash china:city beijin chongqing
1) "wx4dzjubj70"
2) "wm5xzrybty0"
  • geo底层实现原理其实是Zset!
127.0.0.1:6379[6]> zrange china:city 0 -1
1) "chongqing"
2) "shenzhen"
3) "nanchang"
4) "hangzhou"
5) "shanghai"
6) "beijin"
127.0.0.1:6379[6]> zrem china:city beijin
(integer) 1
127.0.0.1:6379[6]> zrange china:city 0 -1
1) "chongqing"
2) "shenzhen"
3) "nanchang"
4) "hangzhou"
5) "shanghai"

Hyperloglog

什么是基数

A{1,3,5,7,9}
B{1,3,5,7,8}
基数(不重复的元素)=5,可以接受误差!

简介

Redis2.8.9版本就更新了Hyperloglog数据结构!
Redis Hyperloglog 基数传统的算法!
优点:占用内存是固定的,2^ 64不同的元素的技术!如果从内存角度比较的话Hyperloglog首选。
网页的uv(一个人访问一个网站多次,但是还是算作一个人!)
传统方式,set保存用户id,可以统计set中元素数量作为标准判断!
这个方式如果保存大量用户id,就比较麻烦!目的为了计数,而不是保存用户id;
0.91%错误率!传统的UV任务,可以忽略不计!

测试数据
127.0.0.1:6379> pfadd pfset a b c d e f g h j j i #创建第一组元素
(integer) 1
127.0.0.1:6379> pfcount pfset #统计第一组元素基数数量
(integer) 10
127.0.0.1:6379> pfadd pfkey a s s s d s r d  #创建第二组
(integer) 1
127.0.0.1:6379> pfcount pfkey
(integer) 4
127.0.0.1:6379> pfmerge pf  pfset pfkey #合并两组
OK
127.0.0.1:6379> pfcount pf #查看并集数量
(integer) 12

如果允许容错,一定可以使用!
不允许就用自己的数据类型!

Bitmaps

位存储:

两个状态的,都可以用:同城感染人数、统计用户信息(活跃、不活跃)、登录,未登录、打卡!

测试数据

使用Bitmaps来记录周一到周日的打卡:

127.0.0.1:6379[8]> setbit sign 0 1
(integer) 0
127.0.0.1:6379[8]> setbit sign 1 0
(integer) 0
127.0.0.1:6379[8]> setbit sign 2 1
(integer) 0
127.0.0.1:6379[8]> setbit sign 3 1
(integer) 0
127.0.0.1:6379[8]> setbit sign 4 0
(integer) 0
127.0.0.1:6379[8]> setbit sign 5 0
(integer) 0
127.0.0.1:6379[8]> setbit sign 6 0
(integer) 0

查看某一天是否有打卡:

127.0.0.1:6379[8]> getbit sign 4
(integer) 0
127.0.0.1:6379[8]> getbit sign 3
(integer) 1

统计操作,统计打卡天数:

127.0.0.1:6379[8]> bitcount sign
(integer) 3
80.redis:三种特殊数据类型:Geospatial,Hyperloglog,Bitmaps redis的三种特殊数据类型:Geospatial,Hyperloglog,Bitmaps 阅读详情

相关推荐

TCP三次握手,四次挥手的全过程,为什么需要三次握手,四次挥手

文章目录TCP介绍三次握手四次挥手滑动窗口拥塞避免算法 TCP介绍 三次握手 四次挥手

热爱编程的菜鸟 1万+

Redis之Geospatial

Redis 在 3.2 版本中加入了地理空间(geospatial)以及索引半径查询的功能,主要用在需要地理位置的应用上。将指定的地理空间位置(经度、纬度、名称)添加到指定的 key 中,这些数据将会存储到 sorted set。这样的目的是为了方便使用 GEORADIUS 或者 GEORADIUSBYMEMBER 命令对数据进行半径查询等操作。也就是说,推算地理位置的信息,两地之间的距离,周围方圆的人等等场景都可以用它实现。小结:geo 底层原理是使用 zset来实现的...

qq_53267860的博客 1150

python-pptx库中文文档及使用样例

个人使用样例及部分翻译自官方文档,并详细介绍chart的使用

4万+

Redis-Geospatial数据类型及其常用命令详解

Redis-Geospatial数据类型及其常用命令详解

喻师傅的学习笔记 1643

9 HAL库驱动框架简述(STM32HAL库)

HAL库外设的使用步骤总结如下:1、定义并填充xxx外设句柄结构体。2、如果遵循HAL库规范,通过HAL_xxx_MspInit()函数,实现外设底层资源的初始化,包括但不限于GPIO、时钟、DMA、中断等资源的初始化。3、调用HAL库的对应外设初始化函数,形如:HAL_xxx_Init()。4、初始化完成,开始使用外设。5、使用方法具体查看对应外设的HAL库驱动包中的说明:补充:HAL库使用主线外设初始化外设使用。

qq_25218501的博客 1985

ARM双核锁步DCLS Lockstep技术研究(FPGA实现)

基于《Applying Dual-Core Lockstep in Embedded Processors to Mitigate Radiation-induced Soft Errors》文章总结 RISC-V双核锁步DCLS Lockstep技术参考之前文章: RISC-V双核锁步DCLS Lockstep技术总结_远古架构师alanwu的博客-CSDN博客https://blog.csdn.net/heyuming20062007/article/details/123329537ARM+RIS

heyuming20062007的博客 8736

【Redis】Redis 中地理位置功能 Geospatial 了解一下?

Geospatial Indexes 是 Redis 提供的一种数据结构,用于存储和查询地理位置信息。它可以将地理位置的经度和纬度编码为二维平面上的点,并支持根据距离或矩形区域查询附近的地理位置点,这使得它在很多场景下被广泛应用,比如 LBS(Location Based Service)、智能推荐、出行规划等。Redis 中 Geospatial Indexes 是通过有序集合实现的,其内部使用 zset 数据类型来存储地理位置点的经纬度和成员信息。

DreamSun的博客 3460

Linux命令行入门:从零掌握服务器运维与Shell脚本基础

在信息化时代,操作系统是数字世界的基石,而终端命令行则是高效驾驭服务器的核心技能。无论是软件部署、服务监控还是故障排查,掌握基于Shell的指令操作都能大幅提升工程效率。从最基础的文件目录管理、文本处理,到权限控制、进程监控与网络调试,命令行提供了一套强大且可自动化的操作范式。尤其对于运维工程师和开发者而言,理解管道、重定向以及脚本化任务,意味着将重复劳动转化为可复用的自动化流程。本文从环境准备讲起,系统梳理常用Linux命令的实际场景与输出验证,并延伸至Shell脚本编写与定时任务,帮助初学者快速建立从操

weixin_30522983的博客 264

Redis篇——Redis操作三大特殊数据类型(比较常见的geospatial地理空间、hyperloglogs基数统计和bitmaps位图场景)

该数据类型,在早些的3.2版本就已经发布了。这个功能可以推算地理位置的信息,两地之间的距离等等。

我热爱学习,也乐于分享。无论是科技前沿的洞见,还是生活中的小技巧,我都会在这里与你分享。我相信,知识就是力量,而分享则能让这份力量得到更好的传递。 751

Windows下Python调用D435i相机避坑指南:从SDK版本选择到RealSense Viewer报错解决

本文详细介绍了在Windows环境下使用Python调用Intel D435i相机的完整避坑指南。重点解决了SDK版本选择问题,推荐使用稳定的Intel RealSense SDK 2.54.2版本,并提供了从环境配置、常见报错解决到实际应用案例的全流程实践指导,帮助开发者高效完成相机部署与开发。

palm99的专栏 930

Uncaught ReferenceError: process is not defined

这个错误 Uncaught ReferenceError: process is not defined 通常出现在浏览器环境中,因为 process 是 Node.js 环境的内置对象,并不是浏览器原生支持的。因此,浏览器无法识别 process,导致该错误。在App.vue中加上以下代码就能够有效解决。

猿小白的博客 1750

redis特殊数据类型-Geospatial(地理位置)用法

redis特殊数据类型-Geospatial(地理位置)用法

weixin_54097396的博客 1050

Unity 热更 之 【YooAsset 热更】几分钟快速了解 YooAsset [功能面板]、以及 [基础代码] 说明

Unity 的资源管理系统不断发展,以适应不同项目的需求和解决特定的问题。AssetBundle 和 Addressable Asset System 是 Unity 官方提供的资源管理解决方案,而 YooAsset 是第三方提供的资源管理系统。简化的API和易用性YooAsset 可能提供了更简单直观的 API,使得资源加载和管理更加容易。对于不熟悉 Addressable 或 AssetBundle 复杂配置的开发者来说,YooAsset 可能是一个更易于上手的选择。性能优化。

仙魁XAN 2965

Redis——三种特殊数据类型 Geospatial Hyperloglog Bitmaps

Redis三种特殊数据类型BitmapsBitmaps类型的基础操作应用案例HyperloglogHyperLogLog类型的基本操作GeospatialGEO类型的基本操作 Bitmaps Bitmaps这个数据结构可以实现对位的操作。Bitmaps实际上就是字符串,但是它可以对字符串的位进行操作。 可以把Bitmaps想象成一个以位为单位数组,数组中的每个单元只能存0或者1,数组的下标在bitmaps中叫做偏移量。单个bitmaps的最大长度是512MB,即2^32个比特位。 详细可以参考大佬写的 Bi

Cantevenl的博客 2659

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Redis中的三种特殊数据类型,geospatial类型,Hyperloglog类型和Bitmaps类型

文章目录Redis中的三种特殊数据类型,geospatial类型,Hyperloglog类型和Bitmaps类型geospatial类型查询城市经纬度的网址geoadd 命令geopos命令geodist命令georadius命令georadiusbymember命令geohash命令geospatial类型的底层封装Hyperloglog类型Hyperloglog的使用场景Hyperloglog类型的常用命令PFadd命令和PFcount命令和PFmerge命令Bitmaps类型Bitmaps的应用场景B

xzy的博客 1310

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Redis 三种特殊数据类型 geospatial,Hyperloglog,Bitmaps

其实三种特殊数据类型还是由五大数据类型实现的,方便用户使用 一、Geospatial 类型(地理位置存储)本质还是一个集合 geoadd key 经度 纬度 名称 两极无法直接添加 geopos 获取集合里指定位置的经纬度 geodist 位置一 位置二 km/m 得到两个指定位置的距离(打车软件或地图软件里距离计算) georadius 经度 纬度 半径 km 以给定经纬度为中心在集合内查找半径内的元素 georadiusbymember 找出位于集合内某位置

MH3709的博客 236

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Redis学习(三) -- 三种特殊数据类型geospatial、hyperloglog、bitmaps

Redis学习 -- 三种特殊数据类型geospatial、hyperloglog、bitmaps一、Geospatial类型1、添加地理位置2、获取指定位置的地理坐标3、获取另个指定位置之间的距离4、获取指定位置附近的位置5、将二维经纬度转为一维字符串6、删除一个位置元素二、Hyperloglog类型1、什么是hyperloglog?2、具体使用三、Bitmaps 一、Geospatial类型 这种类型指的就是地理位置,可以用来存储地理位置。 也可以推算地理位置的信息,两地之间的距离,方圆几里的人 详情可

书生灬今天不吃饭的博客 511

【Redis】Redis三种特殊数据类型(geospatial,hyperloglog,Bitmaps)

三种特殊数据类型(geospatial,hyperloglog,Bitmaps) geospatial geoadd 添加地理位置信息 该命令以采用标准格式的参数x y,所以经度必须在纬度之前。这些坐标的限制是可以被编入索引的,区域面积可以很接近极点但是不能索引。具体的限制,由EPSG:900913 / EPSG:3785 / OSGEO:41001规定如下: 有效的经度从-180度到180度。 有效的纬度从-85.05112878度到85.05112878度。 当坐标位置超出上述指定范围时,该命令将会

weixin_44175122的博客 252

Redis三种特殊数据类型之Geospatial(地理空间)、Hyperloglog(基数)、Bitmaps(位存储)

Redis三种特殊数据类型之Geospatial(地理空间)、Hyperloglog(基数)、Bitmaps(位存储) 一、Geospatial(地理空间) 中文官方文档 写的非常清楚 Geospatial(地理空间)主要应用在朋友的定位、附近的人、打车距离计算 GEOADD 将指定的地理空间位置(纬度、经度、名称)添加到指定的key中 localhost:2>geoadd china:city 116.40 31.23 beijing "1" localhost:2>geoadd chi

weixin_43484014的博客 352

Redis 三种特殊的数据类型 - Geospatial地理位置 - Hyperloglog基数统计的算法 - Bitmaps位图(位存储)

优点∶占用的内存是固定,2^64不同的元素的技术,只需要废12KB内存!因为我们的目的是计数用户数量,而并不是用来保存用户id的。两个状态的,都可以使用Bitmaps!#规则:两极是无法直接添加的,我们一般会下载城市数据,直接通过java或者python程序导入!传统的方式,set 保存用户的id,然后就可以统计set 中的元素数量作为标准判断!(获得所有的附近的人的地址,定位!这个功能可以推算地理位置的信息,比如说两地之间的距离,方圆几里之内的人。如我需要查询朋友的定位,附近的人,打车所需距离的计算?

lpfstudy的博客 348

❤️Bitmaps、HyperLogLog、Geospatial❤️——Redis三大特殊数据类型详述(万字长文原理讲解,大厂面试高频知识点,一文尽收囊中)

本文已收录于专栏 ❤️《Redis之大厂必备技能包》❤️ 欢迎各位关注、三连博主的文章及专栏,全套Redis学习资料,大厂必备技能! 目录 简介 一、Bitmaps 1、简介 2 、基本操作 2.1 SETBIT key offset value 2.2 GETBIT key offset 2.3 BITCOUNT key [start] [end] 2.4 BITPOS key bit [start] [end] 2.5 BITOP operation destkey key [k

Java框架、并发编程、分布式、微服务、Redis、HarmonyOS、中间件等技术 2035

redis学习(2)----geospatial、Hyperloglog、Bitmaps

Redis三种特殊数据类型 1、geospatial地理位置 该功能可以推算地理位置信息,两地之间的距离 只有6个命令: GEOADD 添加地理位置,可通过java直接导入! 参数 key 值(经度 纬度 名称) geoadd china:city 116.40 39.90 beijin geoadd china:city 121.47 31.23 shanghai geoadd china:city 160.50 29.53 chongqing 114.05 22.52 shenzhen geo

leonsccott的博客 253

详解redis的三种特殊数据类型

介绍redis的三种特殊数据类型

奔走的王木木Sir的博客 3709

Redis数据类型详解(5基本+3特殊)

目录一、五大基本数据类型String(字符串)List(列表)Set(集合)Hash(哈希)Zset(有序集合)二、三种特殊数据类型geospatial(地理位置)1. GEOADD2. GEOPOS3. GEODIST4. GEORADIUS5. GEORADIUSBYMEMBER6. GEOHASH总结hyperloglog1. 简介2. 应用场景3. 命令4. 示例5. 总结bitmaps1. 简介2. 示例 一、五大基本数据类型 Redis 是一个开源(BSD许可)的,内存中的数据结构存储系统,它可

欢迎来到 Baret-H 的博客 4059

Redis数据库(三):Redis数据库三种特殊数据类型

除了上一篇博客讲的五种基本数据类型外,Redis还有三种特殊的数据类型,它们有着不同的应用场景,这一篇博客,我们来学习它。

weixin_47040031的博客 881

四.Redis学习:特殊数据类型

特殊数据类型geogeoaddgeoposgeodistgeoradiusgeoradiusbymembergeo扩展bitmapsetbitgetbitbitcountbitposbitopbitmap扩展hyperloglogpfaddpfcountpfmerge 简介 Redis除了五个基本数据类型之外,还额外提供了geospatial(地理空间geo)、bitmaps、hyperlog...

suziyong的博客 320
上一篇: Redis自我介绍及五大数据类型
下一篇: Redis事务
FanZheGOGOGO
博客等级 码龄8年 191粉丝 125原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值