Skip to content

Instantly share code, notes, and snippets.

View navi2589's full-sized avatar

Navnath Chinchore navi2589

View GitHub Profile
public void deleteCachedString(String key, Handler<AsyncResult<Long>> handler) {
redisClient.del(key, handler);
}
@navi2589
navi2589 / GetLockOnKey.java
Last active September 5, 2021 09:17
GetLockOnKey
/*
* 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();
@navi2589
navi2589 / JaywayJsonpathUsage.java
Created December 12, 2021 12:43
Example Of Jayway Jsonpath Library Usage.
public class JaywayJsonpathUsage {
/*
Given a below json. main method will extract value of json attibute a and prints its value.
{
"a": 1,
"b": 2
}
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();