Class HazelcastCacheManager
java.lang.Object
com.norconex.crawler.core.cluster.impl.hazelcast.HazelcastCacheManager
- All Implemented Interfaces:
CacheManager,Closeable,AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionHazelcastCacheManager(com.hazelcast.core.HazelcastInstance hazelcastInstance) -
Method Summary
Modifier and TypeMethodDescription<T> voidaddCacheEntryChangeListener(@NonNull CacheEntryChangeListener<T> listener, String cacheName) Adds a cache entry change listener to the specified cache.booleancacheExists(String name) voidClears all caches.voidclose()voidConsumes every caches, where record value are serialized JSON String.Gets the admin cache for storing administrative data.<T> CacheMap<T> getCacheMap(String name, Class<T> valueType) Gets a named cache storing objects of the supplied type.<T> CacheQueue<T> getCacheQueue(String name, Class<T> valueType) Gets a FIFO queue.getCacheSet(String name) As string-based set, keeping only unique keys.Gets a generic shared cache bound to a crawler that persists forever (never deleted).Gets a generic shared cache tied to a specific crawler run and does not get persisted when the crawler run terminates.Gets a generic shared cache bound to a crawl session that persists until a new crawl session is started (for the same crawler).static com.hazelcast.core.HazelcastInstancegetHazelcastInstance(String name) Returns theHazelcastInstancewith the given name using Hazelcast's own instance registry.Gets the pipeline step cache for storing current pipeline steps.Gets the pipeline worker status cache for storing worker statuses.voidimportCaches(List<SerializedCache> caches) Import caches previously exported withCacheManager.exportCaches(Consumer).<T> voidremoveCacheEntryChangeListener(@NonNull CacheEntryChangeListener<T> listener, String cacheName) Removes a cache entry change listener from the specified cache.com.hazelcast.core.HazelcastInstancevendor()Gets the vendor-specific implementation object.
-
Constructor Details
-
HazelcastCacheManager
public HazelcastCacheManager(com.hazelcast.core.HazelcastInstance hazelcastInstance)
-
-
Method Details
-
getHazelcastInstance
Returns theHazelcastInstancewith the given name using Hazelcast's own instance registry. Returnsnullif no instance with that name is currently running on this JVM. -
getCacheMap
Description copied from interface:CacheManagerGets a named cache storing objects of the supplied type. By default the returned cache is persisted, but cache implementations may decide otherwise (based on cache name, configuration, etc.).- Specified by:
getCacheMapin interfaceCacheManager- Type Parameters:
T- type of the value to store- Parameters:
name- cache namevalueType- class of the value to store- Returns:
- a named cache
-
getCacheSet
Description copied from interface:CacheManagerAs string-based set, keeping only unique keys.- Specified by:
getCacheSetin interfaceCacheManager- Parameters:
name- cache name- Returns:
- a named cache set
-
getCacheQueue
Description copied from interface:CacheManagerGets a FIFO queue.- Specified by:
getCacheQueuein interfaceCacheManager- Type Parameters:
T- the type of elements in the queue- Parameters:
name- the queue namevalueType- the value type- Returns:
- cache queue
-
getCrawlerCache
Description copied from interface:CacheManagerGets a generic shared cache bound to a crawler that persists forever (never deleted).- Specified by:
getCrawlerCachein interfaceCacheManager- Returns:
- crawler-scoped persistent cache
-
getCrawlSessionCache
Description copied from interface:CacheManagerGets a generic shared cache bound to a crawl session that persists until a new crawl session is started (for the same crawler).- Specified by:
getCrawlSessionCachein interfaceCacheManager- Returns:
- crawl session-scoped persistent cache
-
getCrawlRunCache
Description copied from interface:CacheManagerGets a generic shared cache tied to a specific crawler run and does not get persisted when the crawler run terminates.- Specified by:
getCrawlRunCachein interfaceCacheManager- Returns:
- crawl run non-persistent cache
-
cacheExists
- Specified by:
cacheExistsin interfaceCacheManager
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
vendor
public com.hazelcast.core.HazelcastInstance vendor()Description copied from interface:CacheManagerGets the vendor-specific implementation object.- Specified by:
vendorin interfaceCacheManager- Returns:
- vendor implementation
-
exportCaches
Description copied from interface:CacheManagerConsumes every caches, where record value are serialized JSON String. Entries are lazy loaded.- Specified by:
exportCachesin interfaceCacheManager- Parameters:
c- serialized cache.
-
importCaches
Description copied from interface:CacheManagerImport caches previously exported withCacheManager.exportCaches(Consumer).- Specified by:
importCachesin interfaceCacheManager- Parameters:
caches- caches to import
-
clearCaches
public void clearCaches()Description copied from interface:CacheManagerClears all caches.- Specified by:
clearCachesin interfaceCacheManager
-
getAdminCache
Description copied from interface:CacheManagerGets the admin cache for storing administrative data.- Specified by:
getAdminCachein interfaceCacheManager- Returns:
- admin cache
-
getPipelineStepCache
Description copied from interface:CacheManagerGets the pipeline step cache for storing current pipeline steps.- Specified by:
getPipelineStepCachein interfaceCacheManager- Returns:
- pipeline step cache
-
getPipelineWorkerStatusCache
Description copied from interface:CacheManagerGets the pipeline worker status cache for storing worker statuses.- Specified by:
getPipelineWorkerStatusCachein interfaceCacheManager- Returns:
- pipeline worker status cache
-
addCacheEntryChangeListener
public <T> void addCacheEntryChangeListener(@NonNull @NonNull CacheEntryChangeListener<T> listener, String cacheName) Description copied from interface:CacheManagerAdds a cache entry change listener to the specified cache.- Specified by:
addCacheEntryChangeListenerin interfaceCacheManager- Type Parameters:
T- the type of values in the cache- Parameters:
listener- the listener to addcacheName- the name of the cache
-
removeCacheEntryChangeListener
public <T> void removeCacheEntryChangeListener(@NonNull @NonNull CacheEntryChangeListener<T> listener, String cacheName) Description copied from interface:CacheManagerRemoves a cache entry change listener from the specified cache.- Specified by:
removeCacheEntryChangeListenerin interfaceCacheManager- Type Parameters:
T- the type of values in the cache- Parameters:
listener- the listener to removecacheName- the name of the cache
-