Redis的底层类型之json

werbenhu / 231 / 2023-09-25 11:21:08

ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。
https://ckai.xyz

关于redisjson

The JSON capability of Redis Stack provides JavaScript Object Notation (JSON) support for Redis. 可以看到redis json是输入RedisStack的一部分。

那么RedisStack又是什么呢?

Redis Stack is the best starting point for working with Redis. We've bundled together the best of the technology that we have to offer into an easy-to-use package. Redis Stack extends the core features of Redis OSS and provides a complete developer experience for debugging and more.

RedisStack 是使用 Redis 的最佳起点。我们已经把我们必须提供的最好的技术捆绑在一起,形成一个易于使用的软件包。Redis Stack 扩展了 Redis OSS 的核心特性,并为调试等提供了完整的开发人员体验。

Redis Stack 将以下功能捆绑到 Redis 中:JSON、搜索和查询、时间序列和概率性。

Redis Stack packaging
There are two distinct Redis Stack packages to choose from:
有两种不同的 Redis Stack 包可供选择:

Redis Stack Server: This package contains Redis OSS and module extensions only. It does not contain RedisInsight, the developer desktop application. This package is best for production deployment and is intended to be a drop-in replacement (for example, if you're already deploying Redis OSS as a cache). You can still download RedisInsight separately.

Redis Stack Server:该包仅包含 Redis OSS 和模块扩展。它不包含 RedisInsight 开发人员桌面应用程序。这个包最适合生产部署,并旨在作为替代品(例如,如果您已经将 Redis OSS 部署为缓存)。您仍然可以单独下载 RedisInsight。

Redis Stack: This package contains everything a developer needs in a single bundle. This includes Redis Stack Server (Redis OSS and module extensions) along with the RedisInsight desktop application (or part of the docker container). If you want to create an application locally and explore how it interacts with Redis, this is the package for you.

Redis Stack:这个包包含开发人员在一个单独的捆绑包中所需的一切。这包括 Redis Stack Server(Redis OSS 和模块扩展)以及 RedisInsight 桌面应用程序(或 Docker 容器的一部分)。如果您想在本地创建一个应用程序并探索它与 Redis 的交互方式,这个包适合您。

如何安装redis-statck

version: "3.7"

services:
    redis:
      image: redis/redis-stack-server:latest
      container_name: redisstack
      hostname: redisstack
      restart: always
      ports:
        - "16379:6379"
      volumes:
        # - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
        - ./data:/data
        - ./logs:/logs
      command:
        redis-stack-server --requirepass aimore@123456
      networks:
        - default

networks:
  default:
    external:
      name: aimore

命令

  • JSON.SET
JSON.SET key path value [NX | XX]

JSON.SET doc $ '{"a":2}'
JSON.SET doc $.a '3'

JSET.SET returns a simple string reply: OK if executed correctly or nil if the specified NX or XX conditions were not met.

  • JSON.GET
JSON.GET key [INDENT indent] [NEWLINE newline] [SPACE space] [path
  [path ...]]

Return the value at path in JSON serialized form

  • JSON.DEL
JSON.DEL key [path]

作者
werbenhu
许可协议
CC BY 4.0
发布于
2023-09-25
修改于
2024-06-18
Bonnie image
尚未登录