RedisJSON - Fastest way to get json and map it to a class #4000
Answered
by
sazzad16
Mateusz-Platek
asked this question in
Q&A
|
Hello, I want to set and then get json. Code below works fine but method unifiedJedis.setJsonObjectMapper(new GsonObjectMapper());
Movie movie1 = Movie.builder().title("my, title").tagline("my, tagline").build();
unifiedJedis.jsonSetWithEscape("movie:1", movie1);
Movie movie2 = unifiedJedis.jsonGet("movie:1", Movie.class);I have tried to update it following the docs but I get GsonObjectMapper gsonObjectMapper = new GsonObjectMapper();
Movie movie1 = Movie.builder().title("my, title").tagline("my, tagline").build();
unifiedJedis.jsonSet("movie:1", gsonObjectMapper.toJson(movie1));
Movie movie2 = gsonObjectMapper.fromJson(unifiedJedis.jsonGet("movie:1").toString(), Movie.class);If I map object to json and then to class code works but is slower than in the version with deprecated method. GsonObjectMapper gsonObjectMapper = new GsonObjectMapper();
Movie movie1 = Movie.builder().title("my, title").tagline("my, tagline").build();
unifiedJedis.jsonSet("movie:1", gsonObjectMapper.toJson(movie1));
String movieJson = gsonObjectMapper.toJson(unifiedJedis.jsonGet("movie:1"));
Movie movie2 = gsonObjectMapper.fromJson(movieJson, Movie.class);Is there a way to speed up entire process of getting object and mapping it to class? |
Answered by
sazzad16
Oct 23, 2024
Replies: 2 comments
|
@Mateusz-Platek Thank you for using Jedis. I couldn't find a suggestion that's not deprecated. We'll discuss and reconsider our deprecations related to RedisJSON v1. In the mean time please continue using the deprecated methods. |
0 replies
Answer selected by
Mateusz-Platek
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Mateusz-Platek Thank you for using Jedis.
I couldn't find a suggestion that's not deprecated. We'll discuss and reconsider our deprecations related to RedisJSON v1. In the mean time please continue using the deprecated methods.