JSON 的文档数据库 RedisJson 介绍

   redisJson官网地址:RedisJSON Tutorial | Redis Developer Hub

   RedisJSON 使 RediSearch 能够索引 JSON 文档,因此用户现在可以通过索引和查询内容来查找文档。这些组合模块为您提供了一个强大的、低延迟的、面向 JSON 的文档数据库!

先决条件:#

  • Redis 6.x 或更高版本
  • RediSearch 2.2 或更高版本
  • RediJSON 2.0 或更高版本

RedisJson发布官方性能报告,性能碾压ES和Mongo:

RedisJSON: Public Preview & Performance Benchmarking | Redis

 JRedisJSONRedisJSON: Public Preview & Performance Benchmarking | Redis的 Java 客户端库:

 该客户端提供对 RedisJSON 的 Redis API 的访问,并提供 Java 及其对象之间的来回序列化。该客户端目前支持核心 RedisJSON 命令。

 import redis.clients.jedis.Jedis;
import com.redislabs.modules.rejson.JReJSON;

// First get a connection
JReJSON client = new JReJSON("localhost", 6379);

// Setting a Redis key name _foo_ to the string _"bar"_, and reading it back
client.set("foo", "bar");
String s0 = (String) client.get("foo");

// Omitting the path (usually) defaults to the root path, so the call above to
// `get()` and the following ones // are basically interchangeable
String s1 = (String) client.get("foo", new Path("."));
String s2 = (String) client.get("foo", Path.ROOT_PATH);

// Any Gson-able object can be set and updated
client.set("obj", new Object());             // just an empty object
client.set("obj", null, new Path(".zilch"));
Path p = new Path(".whatevs");
client.set("obj", true, p);
client.set("obj", 42, p);
client.del("obj", p);                        // back to almost nothing

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值