Class OCSPCache
- java.lang.Object
-
- org.apache.synapse.transport.certificatevalidation.ocsp.OCSPCache
-
- All Implemented Interfaces:
ManageableCache
public class OCSPCache extends Object implements ManageableCache
This is a cache to store OSCP responses against Certificate Serial Number since an OCSP response depends on the certificate. This is a singleton since more than one cache of this kind should not be allowed. This cache can be shared by many transports which need SSL validation through OCSP.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OCSPCachegetCache(int cacheSize, int cacheDelayMins)intgetCacheSize()org.bouncycastle.cert.ocsp.SingleRespgetCacheValue(BigInteger serialNumber)ManageableCacheValuegetNextCacheValue()This method is needed by the cache Manager to go through the cache entries to remove invalid values or to remove LRU cache values if the cache has reached its max size.voidinit(int size, int delay)This lazy initializes the Cache with a CacheManager.voidremoveCacheValue(BigInteger serialNumber)voidresetIterator()voidsetCacheValue(BigInteger serialNumber, org.bouncycastle.cert.ocsp.SingleResp singleResp, org.bouncycastle.cert.ocsp.OCSPReq request, String serviceUrl)
-
-
-
Method Detail
-
getCache
public static OCSPCache getCache(int cacheSize, int cacheDelayMins)
-
init
public void init(int size, int delay)This lazy initializes the Cache with a CacheManager. If this method is not called, a cache manager will not be used.- Parameters:
size- max size of the cachedelay- defines how frequently the CacheManager will be started
-
getNextCacheValue
public ManageableCacheValue getNextCacheValue()
This method is needed by the cache Manager to go through the cache entries to remove invalid values or to remove LRU cache values if the cache has reached its max size. Todo: Can move to an abstract class.- Specified by:
getNextCacheValuein interfaceManageableCache- Returns:
- next cache value of the cache.
-
getCacheSize
public int getCacheSize()
- Specified by:
getCacheSizein interfaceManageableCache- Returns:
- the current cache size (size of the hash map)
-
resetIterator
public void resetIterator()
- Specified by:
resetIteratorin interfaceManageableCache
-
getCacheValue
public org.bouncycastle.cert.ocsp.SingleResp getCacheValue(BigInteger serialNumber)
-
setCacheValue
public void setCacheValue(BigInteger serialNumber, org.bouncycastle.cert.ocsp.SingleResp singleResp, org.bouncycastle.cert.ocsp.OCSPReq request, String serviceUrl)
-
removeCacheValue
public void removeCacheValue(BigInteger serialNumber)
-
-