Redis学习笔记-Redis基础

Redis学习笔记

Redis官网:https://redis.io/

Redis教程:♥Redis教程 - Redis知识体系详解♥ | Java 全栈知识体系 (pdai.tech)

Redis视频教程:https://www.bilibili.com/video/BV1cr4y1671t

Redis基础

Redis通用命令

在命令行显示所有的通用命令
127.0.0.1:6379> help @generic

  COPY source destination [DB destination-db] [REPLACE]
  summary: Copy a key
  since: 6.2.0

  DEL key [key ...]
  summary: Delete a key
  since: 1.0.0

  DUMP key
  summary: Return a serialized version of the value stored at the specified key.
  since: 2.6.0

  EXISTS key [key ...]
  summary: Determine if a key exists
  since: 1.0.0

  EXPIRE key seconds [NX|XX|GT|LT]
  summary: Set a key's time to live in seconds
  since: 1.0.0

  EXPIREAT key unix-time-seconds [NX|XX|GT|LT]
  summary: Set the expiration for a key as a UNIX timestamp
  since: 1.2.0

  EXPIRETIME key
  summary: Get the expiration Unix timestamp for a key
  since: 7.0.0

  KEYS pattern
  summary: Find all keys matching the given pattern
  since: 1.0.0

  MIGRATE host port key|"" destination-db timeout [COPY] [REPLACE] [[AUTH password]|[AUTH2 username password]] [KEYS key [key ...]]
  summary: Atomically transfer a key from a Redis instance to another one.
  since: 2.6.0

  MOVE key db
  summary: Move a key to another database
  since: 1.0.0

  OBJECT
  summary: A container for object introspection commands
  since: 2.2.3

  OBJECT ENCODING key
  summary: Inspect the internal encoding of a Redis object
  since: 2.2.3

  OBJECT FREQ key
  summary: Get the logarithmic access frequency counter of a Redis object
  since: 4.0.0

  OBJECT HELP
  summary: Show helpful text about the different subcommands
  since: 6.2.0

  OBJECT IDLETIME key
  summary: Get the time since a Redis object was last accessed
  since: 2.2.3

  OBJECT REFCOUNT key
  summary: Get the number of references to the value of the key
  since: 2.2.3

  PERSIST key
  summary: Remove the expiration from a key
  since: 2.2.0

  PEXPIRE key milliseconds [NX|XX|GT|LT]
  summary: Set a key's time to live in milliseconds
  since: 2.6.0

  PEXPIREAT key unix-time-milliseconds [NX|XX|GT|LT]
  summary: Set the expiration for a key as a UNIX timestamp specified in milliseconds
  since: 2.6.0

  PEXPIRETIME key
  summary: Get the expiration Unix timestamp for a key in milliseconds
  since: 7.0.0

  PTTL key
  summary: Get the time to live for a key in milliseconds
  since: 2.6.0

  RANDOMKEY
  summary: Return a random key from the keyspace
  since: 1.0.0

  RENAME key newkey
  summary: Rename a key
  since: 1.0.0

  RENAMENX key newkey
  summary: Rename a key, only if the new key does not exist
  since: 1.0.0

  RESTORE key ttl serialized-value [REPLACE] [ABSTTL] [IDLETIME seconds] [FREQ frequency]
  summary: Create a key using the provided serialized value, previously obtained using DUMP.
  since: 2.6.0

  SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]
  summary: Incrementally iterate the keys space
  since: 2.8.0

  SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]
  summary: Sort the elements in a list, set or sorted set
  since: 1.0.0

  SORT_RO key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA]
  summary: Sort the elements in a list, set or sorted set. Read-only variant of SORT.
  since: 7.0.0

  TOUCH key [key ...]
  summary: Alters the last access time of a key(s). Returns the number of existing keys specified.
  since: 3.2.1

  TTL key
  summary: Get the time to live for a key in seconds
  since: 1.0.0

  TYPE key
  summary: Determine the type stored at key
  since: 1.0.0

  UNLINK key [key ...]
  summary: Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
  since: 4.0.0

  WAIT numreplicas timeout
  summary: Wait for the synchronous replication of all the write commands sent in the context of the current connection
  since: 3.0.0

127.0.0.1:6379>
常用的通用命令

在这里插入图片描述

Redis String类型

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

Redis Hash类型

在这里插入图片描述

在这里插入图片描述

Redis List类型

在这里插入图片描述

在这里插入图片描述

Redis Set类型

在这里插入图片描述

在这里插入图片描述

Redis SortedSet类型

在这里插入图片描述

在这里插入图片描述

Redis的Java客户端

在这里插入图片描述

创作不易,喜欢的话加个关注点个赞,❤谢谢谢谢❤