Class OCSPRespondersCache
- java.lang.Object
-
- eu.emi.security.authn.x509.helpers.ocsp.OCSPCacheBase
-
- eu.emi.security.authn.x509.helpers.ocsp.OCSPRespondersCache
-
public class OCSPRespondersCache extends OCSPCacheBase
OCSP failing responses cache: in memory with disk persistence. Only IOExceptions are cached.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classOCSPRespondersCache.ResponderCacheEntry
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,OCSPRespondersCache.ResponderCacheEntry>respondersCache-
Fields inherited from class eu.emi.security.authn.x509.helpers.ocsp.OCSPCacheBase
ASCII, diskPath, maxTtl, prefix
-
-
Constructor Summary
Constructors Constructor Description OCSPRespondersCache(long maxTtl, java.io.File diskPath, java.lang.String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToCache(java.lang.String key, java.io.IOException error)voidcheckCachedError(java.lang.String responderKey)Checks if there is a cached and not outdated cache entry for a given responder key.voidclearMemoryCache()java.lang.StringcreateResponderKey(java.security.cert.X509Certificate issuerCert)private OCSPRespondersCache.ResponderCacheEntryloadResponderFromDisk(java.io.File f)private voidstoreResponderToDisk(java.io.File f, OCSPRespondersCache.ResponderCacheEntry entry)-
Methods inherited from class eu.emi.security.authn.x509.helpers.ocsp.OCSPCacheBase
encodeDigest
-
-
-
-
Field Detail
-
respondersCache
private java.util.Map<java.lang.String,OCSPRespondersCache.ResponderCacheEntry> respondersCache
-
-
Constructor Detail
-
OCSPRespondersCache
public OCSPRespondersCache(long maxTtl, java.io.File diskPath, java.lang.String prefix)- Parameters:
maxTtl- maximum time after each cached response expires. Negative for no cache at all, 0 for no limit (i.e. caching time will be only controlled by the OCSP response validity period). In ms.diskPath- if not null, cached responses will be stored on disk.prefix- used if disk cache is enabled, as a common prefix for all files created in the cache directory.
-
-
Method Detail
-
checkCachedError
public void checkCachedError(java.lang.String responderKey) throws java.io.IOExceptionChecks if there is a cached and not outdated cache entry for a given responder key. If this is the case a cached exception is thrown.- Parameters:
responderKey- responder key- Throws:
java.io.IOException- IO exception
-
addToCache
public void addToCache(java.lang.String key, java.io.IOException error) throws java.io.IOException- Throws:
java.io.IOException
-
clearMemoryCache
public void clearMemoryCache()
-
storeResponderToDisk
private void storeResponderToDisk(java.io.File f, OCSPRespondersCache.ResponderCacheEntry entry) throws java.io.IOException- Throws:
java.io.IOException
-
loadResponderFromDisk
private OCSPRespondersCache.ResponderCacheEntry loadResponderFromDisk(java.io.File f)
-
createResponderKey
public java.lang.String createResponderKey(java.security.cert.X509Certificate issuerCert)
-
-