RedisJSON - Fastest way to get json and map it to a class #4000
-
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? |
Beta Was this translation helpful? Give feedback.
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. |
Beta Was this translation helpful? Give feedback.
-
Created #4001 |
Beta Was this translation helpful? Give feedback.
@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.