栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

JSON 的文档数据库 RedisJson 介绍

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

 JRedisJSON是RedisJSON: 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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/606606.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号