Package org.fcrepo.kernel.impl.cache
Class UserTypesCacheImpl
- java.lang.Object
-
- org.fcrepo.kernel.impl.cache.UserTypesCacheImpl
-
- All Implemented Interfaces:
UserTypesCache
@Component public class UserTypesCacheImpl extends Object implements UserTypesCache
Default UserTypesCache implementation- Author:
- pwinckles
-
-
Constructor Summary
Constructors Constructor Description UserTypesCacheImpl(FedoraPropsConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cacheUserTypes(FedoraId resourceId, List<URI> userTypes, String sessionId)
Caches the user RDF types in the session level cache.void
cacheUserTypes(FedoraId resourceId, RdfStream rdf, String sessionId)
Extracts the user RDF types from the RDF and caches them in the session level cache.void
dropSessionCache(String sessionId)
Drops a session level cache without merging it into the global cache.List<URI>
getUserTypes(FedoraId resourceId, String sessionId, Supplier<RdfStream> rdfProvider)
Gets the user RDF types for the specified resource from the cache.void
mergeSessionCache(String sessionId)
Merges the session level cache into the global cache.
-
-
-
Constructor Detail
-
UserTypesCacheImpl
public UserTypesCacheImpl(FedoraPropsConfig config)
-
-
Method Detail
-
getUserTypes
public List<URI> getUserTypes(FedoraId resourceId, String sessionId, Supplier<RdfStream> rdfProvider)
Gets the user RDF types for the specified resource from the cache. First, the session's cache is checked. If the types were not found, then the global cache is checked. If not in either cache, then the rdfProvider is called to load the resource's RDF from which the types are parsed, cached, and returned. This method should NOT be called on binary resources.- Specified by:
getUserTypes
in interfaceUserTypesCache
- Parameters:
resourceId
- the id of the resourcesessionId
- the id of the current sessionrdfProvider
- the provider that is called, if needed, to load the resource's rdf- Returns:
- the resource's user RDF types
-
cacheUserTypes
public void cacheUserTypes(FedoraId resourceId, RdfStream rdf, String sessionId)
Extracts the user RDF types from the RDF and caches them in the session level cache.- Specified by:
cacheUserTypes
in interfaceUserTypesCache
- Parameters:
resourceId
- the id of the resourcerdf
- the resource's RDFsessionId
- the session to cache the types in
-
cacheUserTypes
public void cacheUserTypes(FedoraId resourceId, List<URI> userTypes, String sessionId)
Caches the user RDF types in the session level cache.- Specified by:
cacheUserTypes
in interfaceUserTypesCache
- Parameters:
resourceId
- the id of the resourceuserTypes
- the resource's typessessionId
- the session to cache the types in
-
mergeSessionCache
public void mergeSessionCache(String sessionId)
Merges the session level cache into the global cache.- Specified by:
mergeSessionCache
in interfaceUserTypesCache
- Parameters:
sessionId
- the id of the session to merge
-
dropSessionCache
public void dropSessionCache(String sessionId)
Drops a session level cache without merging it into the global cache.- Specified by:
dropSessionCache
in interfaceUserTypesCache
- Parameters:
sessionId
- the id of the session cache to drop
-
-