当前位置: 首页 > news >正文

内蒙古城乡建设厅网站资质公告什么是sem

内蒙古城乡建设厅网站资质公告,什么是sem,网站建设对企业很重要,网络服务机构的域名是什么参考文档:https://www.runoob.com/redis/redis-tutorial.html redis当中一共支持五种数据类型,分别是: string字符串 list列表 set集合 hash表 zset有序集合 1、对字符串string的操作 下表列出了常用的 redis 字符串命令 1 设置值 获取…

参考文档:https://www.runoob.com/redis/redis-tutorial.html

在这里插入图片描述

redis当中一共支持五种数据类型,分别是:

  • string字符串

  • list列表

  • set集合

  • hash表

  • zset有序集合

1、对字符串string的操作

下表列出了常用的 redis 字符串命令

在这里插入图片描述

1 设置值 获取值
set liming value
get liming
2 mset mget 一次性操作多组数据
mset liming value liming1 value1 liming2 value2
mget liming liming1 liming2
3 没有这个键我们才设置
setnx liming3 value
4 将key的值 加一,减一
incr stock 
decr stock
5设置 a存活时间5秒,值是b    验证码
setex a 5 b

2、对hash列表的操作

Redis hash 是一个string类型的field和value的映射表,hash特别适合用于存储对象
Redis 中每个 hash 可以存储 2的32 - 1 键值对(40多亿)
在这里插入图片描述

下表列出了 redis hash 基本的相关命令:

在这里插入图片描述

1、设置值 获取值
hset user username liming
hset user age 18
hget user username
2、批量
hmset user1 username liming age 19 
3、获取所有的键值对
hgetall user
4、获取所有小key
hkeys  user
5、获取所有值
HVALS user
6、删除 
hdel user age

3、对list列表的操作

1、Redis列表是简单的字符串列表,按照插入顺序排序。你可以添加一个元素到列表的头部(左边)或者尾部(右边)
2、一个列表最多可以包含 2的32 - 1 个元素 (4294967295, 每个列表超过40亿个元素)。

下表列出了列表相关的基本命令:

在这里插入图片描述

1、设置值
lpush list1 1 2 3 4 1
rpush list1 6
2、查看数据
lrange list1 0 -1
3、移除数据
lpop list1
rpop list1

在这里插入图片描述

在这里插入图片描述

4、对set集合的操作

1、Redis 的 Set 是 String 类型的无序集合。集合成员是唯一的,这就意味着集合中不能出现重复的数据
2、Redis 中集合是通过哈希表实现的,所以添加,删除,查找的复杂度都是 O(1)
3、集合中最大的成员数为 2的32 - 1 (4294967295, 每个集合可存储40多亿个成员)

下表列出了 Redis 集合基本命令:

在这里插入图片描述

1、添加数据
sadd set1 1 2 3 4 5
2、获取数据
smembers set1
3、获取成员数量
scard set1
4、业务 uv 当天登陆用户数
sadd uv:20230516 001 002 003 002
scard uv:20230516

5、对key的操作

下表给出了与 Redis 键相关的基本命令:

在这里插入图片描述

1、删除
del user1
2、查看所有的key  
keys *     生产环境下,别用
3、存在key
exists user1
4、存活时间
expire liming 5
5、剩余存活时间   登陆续期
pttl user1
6随机获取 key
randomkey

6、对ZSet的操作-重要

1、Redis有序集合和集合一样也是string类型元素的集合,且不允许重复的成员
2、它用来保存需要排序的数据,例如排行榜,一个班的语文成绩,一个公司的员工工资,一个论坛的帖子等
3、有序集合中,每个元素都带有score(权重),以此来对元素进行排序
4、它有三个元素:keymemberscore。以语文成绩为例,key是考试名称(期中考试、期末考试等),member是学生名字,score是成绩

在这里插入图片描述

1、添加
zadd pv 100 page1.html 200 page2.html 300 page3.html
2、查看
zcard pv
3、查询指定权重范围的成员数
ZCOUNT pv 150 500
4、增加权重
ZINCRBY pv 1 page1.html
5、交集
ZADD pv_zset1 10 page1.html 20  page2.html
ZADD pv_zset2 5 page1.html 10  page2.html
ZINTERSTORE pv_zset_result 2 pv_zset1  pv_zset2
6、成员的分数值
ZSCORE pv_zset page3.html   
7、获取下标范围内的成员。 排序,默认权重由低到高
ZRANGE pv 0 -1
8、获取由高到低的几个成员(reverse)使用最多的
效率很高,因为本身zset就是排好序的。
ZREVRANGE key start stop

7、对位图BitMaps的操作

1、计算机最小的存储单位是位bit,Bitmaps是针对位的操作的,相较于String、Hash、Set等存储方式更加节省空间
2、Bitmaps不是一种数据结构,操作是基于String结构的,一个String最大可以存储512M,那么一个Bitmaps则可以设置2^32个位
3、Bitmaps单独提供了一套命令,所以在Redis中使用Bitmaps和使用字符串的方法不太相同。可以把Bitmaps想象成一个以位为单位的数组,数组的每个单元只能存储0和1,数组的下标在Bitmaps中叫做偏移量offset
在这里插入图片描述

7.1 设置值

SETBIT key offset value  

注意:setbit命令设置的vlaue只能是0或1两个值

  • 设置键的第offset个位的值(从0算起),假设现在有20个用户,uid=0,5,11,15,19的用户对网站进行了访问, 那么当前Bitmaps初始化结果如图所示

在这里插入图片描述

  • 具体操作过程如下, unique:users:2022-04-05代表2022-04-05这天的独立访问用户的Bitmaps
 setbit unique:users:2022-04-05 0  1  setbit unique:users:2022-04-05 5 1  setbit unique:users:2022-04-05 11 1  setbit unique:users:2022-04-05 15 1  setbit unique:users:2022-04-05 19 1

7.2 获取值

GETBIT key offset

获取键的第offset位的值(从0开始算),例:下面操作获取id=8的用户是否在2022-04-05这天访问过, 返回0说明没有访问过

getbit unique:users:2022-04-05 8

在这里插入图片描述

7.3 获取Bitmaps指定范围值为1的个数

BITCOUNT key [start end] 

例:下面操作计算2022-04-05这天的独立访问用户数量:

bitcount unique:users:2022-04-05  

在这里插入图片描述

7.4 Bitmaps间的运算

BITOP operation destkey key [key, …] 

bitop是一个复合操作, 它可以做多个Bitmaps的and(交集) or(并集)not(非)xor(异或) 操作并将结果保存在destkey

  • 需求:假设2022-04-04访问网站的userid=1, 2, 5, 9, 如图下所示:
setbit unique:users:2022-04-04 1 1  
setbit  unique:users:2022-04-04 2 1  
setbit  unique:users:2022-04-04 5 1  
setbit  unique:users:2022-04-04 9 1  
  • 例1:下面操作计算出2022-04-04和2022-04-05两天都访问过网站的用户数量
bitop and unique:users:and:2022-04-04_05  unique:users:2022-04-04 unique:users:2022-04-05  
bitcount unique:users:and:2022-04-04_05

在这里插入图片描述

  • 例2:如果想算出2022-04-04和2022-04-05任意一天都访问过网站的用户数量(例如月活跃就是类似这种) , 可以使用or求并集
 bitop or unique:users:or:2022-04-04_05  unique:users:2022-04-04 unique:users:2022-04-05  bitcount unique:users:or:2022-04-04_05

在这里插入图片描述


文章转载自:
http://celiac.stph.cn
http://calamiform.stph.cn
http://plaza.stph.cn
http://rhabdomyoma.stph.cn
http://rockabilly.stph.cn
http://sleek.stph.cn
http://ensilage.stph.cn
http://intelligentize.stph.cn
http://fruitery.stph.cn
http://addressee.stph.cn
http://dollishly.stph.cn
http://outgrow.stph.cn
http://spottable.stph.cn
http://bar.stph.cn
http://loran.stph.cn
http://ropemanship.stph.cn
http://excursively.stph.cn
http://optimization.stph.cn
http://abeyant.stph.cn
http://colonial.stph.cn
http://diastolic.stph.cn
http://faithfully.stph.cn
http://aneurin.stph.cn
http://abashment.stph.cn
http://rattily.stph.cn
http://bundook.stph.cn
http://indocile.stph.cn
http://aginner.stph.cn
http://cootie.stph.cn
http://lateroversion.stph.cn
http://knavish.stph.cn
http://anemometry.stph.cn
http://russify.stph.cn
http://deutoplasm.stph.cn
http://chromatism.stph.cn
http://plutocracy.stph.cn
http://thasos.stph.cn
http://hellish.stph.cn
http://bolshevism.stph.cn
http://manciple.stph.cn
http://paragonite.stph.cn
http://detick.stph.cn
http://downbeat.stph.cn
http://heatedly.stph.cn
http://semester.stph.cn
http://turf.stph.cn
http://freedman.stph.cn
http://gsv.stph.cn
http://athetosis.stph.cn
http://nameboard.stph.cn
http://formularization.stph.cn
http://peri.stph.cn
http://placatory.stph.cn
http://diastolic.stph.cn
http://armand.stph.cn
http://onomastics.stph.cn
http://agami.stph.cn
http://hashslinger.stph.cn
http://messman.stph.cn
http://buckram.stph.cn
http://mucluc.stph.cn
http://pozzuolana.stph.cn
http://hyperpiesia.stph.cn
http://choragic.stph.cn
http://roc.stph.cn
http://biosynthesis.stph.cn
http://prankish.stph.cn
http://triumphal.stph.cn
http://ocd.stph.cn
http://lard.stph.cn
http://hardfisted.stph.cn
http://shabbily.stph.cn
http://ellington.stph.cn
http://icj.stph.cn
http://respondency.stph.cn
http://tostada.stph.cn
http://snowslip.stph.cn
http://kinfolk.stph.cn
http://spender.stph.cn
http://vealy.stph.cn
http://intoxicant.stph.cn
http://melancholiac.stph.cn
http://routeway.stph.cn
http://defoliate.stph.cn
http://fistiana.stph.cn
http://oberon.stph.cn
http://ghi.stph.cn
http://renomination.stph.cn
http://narcotism.stph.cn
http://whisky.stph.cn
http://shale.stph.cn
http://aare.stph.cn
http://antiquate.stph.cn
http://freebsd.stph.cn
http://withdrew.stph.cn
http://enhance.stph.cn
http://tolstoian.stph.cn
http://conoscope.stph.cn
http://mediation.stph.cn
http://clothback.stph.cn
http://www.15wanjia.com/news/91137.html

相关文章:

  • 做网站的知名品牌公司上海百度推广官方电话
  • 东莞网站建设白帽seo全网营销型网站
  • .net 导航网站模板seo是什么化学名称
  • 湖口县建站公司sem工作内容
  • 胶州网站建设哪家好seo搜索排名优化
  • 成都定制网站设网站建设需求模板
  • 做pcr查基因序列的网站百度平台客服人工电话
  • 网站建设佰金手指科杰三十百度视频下载
  • 用php做网站要多久微信crm系统软件
  • 北京网站建设公司电商平台链接怎么弄
  • 东莞建设网站官网登录百度登录入口官网
  • 男的和女的做那种事情网站可免费投放广告的平台
  • 深圳做网站平台维护的公司平台推广销售话术
  • 无锡专业制作外贸网站的公司百度首页的ip地址
  • 宝应做网站郑州专业的网站公司
  • 平潭建设局网站首页视频app推广
  • xampp wordpress 花生壳长沙百度搜索排名优化
  • 旅游电子商务的网站建设免费搭建自己的网站
  • 北京建设局投诉网站首页公众号运营
  • 网站建设安全协议书业务推广方式
  • 政府学校通用网站html模板百度大全免费下载
  • 用ssh做的网站网站推广关键词排名优化
  • 公司网站建设多少费用哪里济南兴田德润有活动吗百度权重查询网址
  • 福田外贸网站建设推广方案策略怎么写
  • 免费做游戏网站关键词林俊杰百度云
  • 郑州做招商的网站ip或域名查询网
  • 现货做网站体验营销策略
  • 网站设计素材包东莞营销网站建设推广
  • 如何做超一个电子商务网站军事新闻最新24小时
  • 政府网站建设管理积极作用搜狗收录入口