I'm trying to understand how pipeline works nad want to try something different. I've noticed that there's no method for setting expire key if the key doesn't have any so I made an example for that with Jedis.
Example
Map<String, Response> responses = new HashMap<>();long start = System.currentTimeMillis();try (Jedis resource = redisManager.getResource()) { Pipeline pipeline = resource.pipelined(); responses.put("time", pipeline.ttl(args[1])); pipeline.sync(); pipeline.multi(); if (responses.get("time").get().equals(-1L)) { pipeline.expire(args[1], 15); } pipeline.exec();}
I'd like to know that should I use like that or do you have any idea about it? I couldn't find any solution for that.