Class AbstractInMemoryIntegrationServiceCache<T extends Serializable>
java.lang.Object
se.idsec.signservice.integration.core.impl.AbstractIntegrationServiceCache<T>
se.idsec.signservice.integration.core.impl.AbstractInMemoryIntegrationServiceCache<T>
- Type Parameters:
T
- the cached object type
- All Implemented Interfaces:
IntegrationServiceCache<T>
- Direct Known Subclasses:
InMemoryDocumentCache
,InMemoryIntegrationServiceStateCache
public abstract class AbstractInMemoryIntegrationServiceCache<T extends Serializable>
extends AbstractIntegrationServiceCache<T>
Base class for an in-memory implementation of the
IntegrationServiceCache
interface.- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class representing the cache entry.Nested classes/interfaces inherited from class se.idsec.signservice.integration.core.impl.AbstractIntegrationServiceCache
AbstractIntegrationServiceCache.CacheEntry<T extends Serializable>
-
Field Summary
Fields inherited from class se.idsec.signservice.integration.core.impl.AbstractIntegrationServiceCache
MAX_AGE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Utility method that removes expired entries.protected AbstractIntegrationServiceCache.CacheEntry
<T> getCacheEntry
(String id) Gets the cache entry identified byid
.protected void
putCacheObject
(String id, T object, String ownerId, long expirationTime) Adds the supplied entry identified byid
to the cache.protected void
Removes the object identified byid
.
-
Constructor Details
-
AbstractInMemoryIntegrationServiceCache
public AbstractInMemoryIntegrationServiceCache()
-
-
Method Details
-
getCacheEntry
Gets the cache entry identified byid
.- Specified by:
getCacheEntry
in classAbstractIntegrationServiceCache<T extends Serializable>
- Parameters:
id
- the ID- Returns:
- the entry or null
-
putCacheObject
Adds the supplied entry identified byid
to the cache.- Specified by:
putCacheObject
in classAbstractIntegrationServiceCache<T extends Serializable>
- Parameters:
id
- the IDobject
- the object to addownerId
- the owner of the object (may be null)expirationTime
- expiration time (in millis)
-
removeCacheObject
Removes the object identified byid
.- Specified by:
removeCacheObject
in classAbstractIntegrationServiceCache<T extends Serializable>
- Parameters:
id
- the ID
-
clearExpired
public void clearExpired()Utility method that removes expired entries. Should be called by a scheduled task.
-