Created
March 21, 2016 15:42
-
-
Save DinoChiesa/7483b71f1483c413ebda to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private LoadingCache<String, JWSVerifier> macVerifierCache; | |
... | |
macVerifierCache = CacheBuilder.newBuilder() | |
.concurrencyLevel(4) | |
.maximumSize(1048000) | |
.expireAfterAccess(10, TimeUnit.MINUTES) | |
.build(new CacheLoader<String, JWSVerifier>() { | |
public JWSVerifier load(String key) throws UnsupportedEncodingException { | |
byte[] keyBytes = key.getBytes(StandardCharsets.UTF_8); | |
// NB: this will throw if the string is not at least 16 chars long | |
return new MACVerifier(keyBytes); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment