Skip to content

Instantly share code, notes, and snippets.

Avatar

Navnath Chinchore navi2589

View GitHub Profile
View Solution.java
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.ParseContext;
public class Solution {
private static final Configuration configuration = Configuration.builder().options(Option.SUPPRESS_EXCEPTIONS).build();
@navi2589
navi2589 / JaywayJsonpathUsage.java
Created Dec 12, 2021
Example Of Jayway Jsonpath Library Usage.
View JaywayJsonpathUsage.java
public class JaywayJsonpathUsage {
/*
Given a below json. main method will extract value of json attibute a and prints its value.
{
"a": 1,
"b": 2
}
View ReleaseLock
public void deleteCachedString(String key, Handler<AsyncResult<Long>> handler) {
redisClient.del(key, handler);
}
View GetLockOnKey.java
/*
* Cache the string into Redis with the below set options.
*
* EX seconds -- Set the specified expire time, in seconds.
* NX -- Only set the key if it does not already exist.
*/
public void cacheKeyWithTTL(String key, Long expirySeconds,
boolean isNX, String value, Handler<AsyncResult<String>> handler) {
SetOptions options = new SetOptions();