Package mondrian.rolap.agg
Class SegmentCacheWorker
- java.lang.Object
-
- mondrian.rolap.agg.SegmentCacheWorker
-
public final class SegmentCacheWorker extends Object
Utility class to interact with theSegmentCache.- Author:
- LBoudreau
- See Also:
SegmentCache
-
-
Constructor Summary
Constructors Constructor Description SegmentCacheWorker(SegmentCache cache, Thread cacheMgrThread)Creates a worker.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SegmentBodyget(SegmentHeader header)Returns a segment body corresponding to a header.List<SegmentHeader>getSegmentHeaders()Returns a list of segments present in the cache.static List<SegmentCache>initCache()Instantiates a cache.voidput(SegmentHeader header, SegmentBody body)Places a segment in the cache.booleanremove(SegmentHeader header)Removes a segment from the cache.voidshutdown()booleansupportsRichIndex()
-
-
-
Constructor Detail
-
SegmentCacheWorker
public SegmentCacheWorker(SegmentCache cache, Thread cacheMgrThread)
Creates a worker.- Parameters:
cache- Cache managed by this workercacheMgrThread- Thread that the cache manager actor is running on, and which therefore should not be used for potentially long-running calls this this cache. Pass null if methods can be called from any thread.
-
-
Method Detail
-
initCache
public static List<SegmentCache> initCache()
Instantiates a cache. Returns null if there is no external cache defined.- Returns:
- Cache
-
get
public SegmentBody get(SegmentHeader header)
Returns a segment body corresponding to a header.If no cache is configured or there is an error while querying the cache, null is returned none the less.
- Parameters:
header- Header to search.- Returns:
- Either a segment body object or null if there was no cache configured or no segment could be found for the passed header.
-
put
public void put(SegmentHeader header, SegmentBody body)
Places a segment in the cache. Returns true or false if the operation succeeds.- Parameters:
header- A header to search for in the segment cache.body- The segment body to cache.
-
remove
public boolean remove(SegmentHeader header)
Removes a segment from the cache.- Parameters:
header- A header to remove in the segment cache.- Returns:
- Whether a segment was removed
-
getSegmentHeaders
public List<SegmentHeader> getSegmentHeaders()
Returns a list of segments present in the cache.- Returns:
- List of headers in the cache
-
supportsRichIndex
public boolean supportsRichIndex()
-
shutdown
public void shutdown()
-
-