Package ca.uhn.fhir.jpa.cache
Class ResourceChangeListenerCache
java.lang.Object
ca.uhn.fhir.jpa.cache.ResourceChangeListenerCache
- All Implemented Interfaces:
IResourceChangeListenerCache
@Component
@Scope("prototype")
public class ResourceChangeListenerCache
extends Object
implements IResourceChangeListenerCache
-
Constructor Summary
ConstructorsConstructorDescriptionResourceChangeListenerCache(String theResourceName, IResourceChangeListener theResourceChangeListener, SearchParameterMap theSearchParameterMap, long theRemoteRefreshIntervalMs) -
Method Summary
Modifier and TypeMethodDescriptionvoidRequest that a cache be refreshed now, in the current threadbooleanprotected booleanbooleanmatches(org.hl7.fhir.instance.model.api.IBaseResource theResource) If nextRefreshTime is in the past, then update the cache with the current repository contents and notify its listener of any changesvoidRequest that the cache be refreshed at the next convenient time (in a different thread)voidrequestRefreshIfWatching(org.hl7.fhir.instance.model.api.IBaseResource theResource) Refresh the cache if theResource matches our SearchParameterMapsetInitialized(boolean theInitialized) static voidsetNowForUnitTests(String theTime) voidsetResourceChangeListenerCacheRefresher(IResourceChangeListenerCacheRefresher theResourceChangeListenerCacheRefresher) toString()
-
Constructor Details
-
ResourceChangeListenerCache
public ResourceChangeListenerCache(String theResourceName, IResourceChangeListener theResourceChangeListener, SearchParameterMap theSearchParameterMap, long theRemoteRefreshIntervalMs)
-
-
Method Details
-
requestRefresh
Request that the cache be refreshed at the next convenient time (in a different thread)- Specified by:
requestRefreshin interfaceIResourceChangeListenerCache
-
forceRefresh
Request that a cache be refreshed now, in the current thread- Specified by:
forceRefreshin interfaceIResourceChangeListenerCache- Returns:
- counts of detected resource creates, updates and deletes
-
requestRefreshIfWatching
Refresh the cache if theResource matches our SearchParameterMap- Parameters:
theResource-
-
matches
-
refreshCacheIfNecessary
Description copied from interface:IResourceChangeListenerCacheIf nextRefreshTime is in the past, then update the cache with the current repository contents and notify its listener of any changes- Specified by:
refreshCacheIfNecessaryin interfaceIResourceChangeListenerCache- Returns:
- counts of detected resource creates, updates and deletes
-
isTimeToRefresh
-
refreshCacheWithRetry
-
setResourceChangeListenerCacheRefresher
public void setResourceChangeListenerCacheRefresher(IResourceChangeListenerCacheRefresher theResourceChangeListenerCacheRefresher) -
getNextRefreshTime
- Specified by:
getNextRefreshTimein interfaceIResourceChangeListenerCache- Returns:
- the next scheduled time the cache will search the repository, update its cache and notify its listener of any changes
-
getSearchParameterMap
- Specified by:
getSearchParameterMapin interfaceIResourceChangeListenerCache- Returns:
- the search parameter map the listener was registered with
-
isInitialized
- Specified by:
isInitializedin interfaceIResourceChangeListenerCache- Returns:
- whether the cache has been initialized. (If not, the cache will be empty.)
-
setInitialized
-
getResourceName
- Specified by:
getResourceNamein interfaceIResourceChangeListenerCache- Returns:
- the name of the resource type the listener was registered with
-
getResourceVersionCache
-
getResourceChangeListener
-
setNowForUnitTests
- Parameters:
theTime- has format like "12:34:56" i.e. HH:MM:SS
-
clearForUnitTest
-
toString
-