Last active
September 5, 2021 09:17
-
-
Save navi2589/64cfdd77527d9a3f13519ec125371eb2 to your computer and use it in GitHub Desktop.
GetLockOnKey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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(); | |
options.setEX(expirySeconds); | |
options.setNX(isNX); | |
redisClient.setWithOptions(key, value, options, handler); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment