zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

Redis入门一

2023-09-11 14:16:00 时间
Binary-safe strings: 字符串 Lists:有序列表;底层维护的是一个链表结构,包含字符串元素的集合,有顺序、根据插入顺序而定 Sets :无序集合;元素不可重复、无序 集合里面的元素是字符串 Sorted sets:有序集合;和Sets 不同集合里面每个元素都关联了一个 floating number value 叫做score, 集合会根据score来排序 Hashes:散列;类似java的hashMap 由字段-字段值组成, 都是字符串。composed of fields associated with values. Both the field and the value are strings Bit arrays: HyperLogLogs

Redis keys 键值的选择

Very long keys are not a good idea 键值不能太长 Very short keys are often not a good idea.键值太短也不太好 Try to stick with a schema. 键值应该按照一种约定的模式来命名,如: "object-type:id" is a good idea, as in "user:1000". Dots or dashes are often used for multi-word fields, as in "comment:1234:reply.to" or "comment:1234:reply-to".多个单词用点或者斜线分隔 The maximum allowed key size is 512 MB.键值最长不能超过512 MB

Lists:Redis的Lists底层采用的是链表Link lists, 链表的优点:
1.插入速度快、时间复杂度是1 Redis Lists are implemented with linked lists because for a database system it is crucial to be able to add elements to a very long list in a very fast way. Another strong advantage, as youll see in a moment, is that Redis Lists can be taken at constant length in constant time.
缺点:数据量大时访问速度会慢,如果想要快的访问速度可以采用 sort set


Redis(二)入门:概述与安装 Redis通常将全部数据存储在内存中,会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,但只是用于重启后将数据加载回内存,相当于一个数据备份作用。
Redis(一)入门:NoSQL OR SQL,看完这篇你就懂了 非结构数据,根据定义是指数据结构不规则或不完整,没有任何预定义的数据模型,不方便用二维逻辑表来表现数据,例如网页日志、文本文档、图像、视频和音频文件等。