mondrian.rolap.agg
Class SegmentCacheWorker

java.lang.Object
  extended by mondrian.rolap.agg.SegmentCacheWorker

public final class SegmentCacheWorker
extends Object

Utility class to interact with the SegmentCache.

Version:
$Id: //open/mondrian/src/main/mondrian/rolap/agg/SegmentCacheWorker.java#14 $
Author:
LBoudreau
See Also:
SegmentCache

Constructor Summary
SegmentCacheWorker()
           
 
Method Summary
static boolean contains(SegmentHeader header)
          Returns whether there is a cached segment body available for a given segment header.
static void flush(SegmentHeader.ConstrainedColumn[] region)
          Flushes a segment from the cache.
static SegmentBody get(SegmentHeader header)
          Returns a segment body corresponding to a header.
static List<SegmentHeader> getSegmentHeaders()
          Returns a list of segments present in the cache.
static boolean isCacheEnabled()
           
static void put(SegmentHeader header, SegmentBody body)
          Places a segment in the cache.
static void remove(SegmentHeader header)
          Removes a segment from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentCacheWorker

public SegmentCacheWorker()
Method Detail

get

public static 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. To adjust timeout values, set MondrianProperties.SegmentCacheReadTimeout

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.

contains

public static boolean contains(SegmentHeader header)
Returns whether there is a cached segment body available for a given segment header.

If no cache is configured or there is an error while querying the cache, false is returned none the less. To adjust timeout values, set MondrianProperties.SegmentCacheLookupTimeout

Parameters:
header - A header to search for in the segment cache.
Returns:
True or false, whether there is a segment body available in a segment cache.

put

public static void put(SegmentHeader header,
                       SegmentBody body)
Places a segment in the cache. Returns true or false if the operation succeeds.

To adjust timeout values, set the MondrianProperties.SegmentCacheWriteTimeout property.

Parameters:
header - A header to search for in the segment cache.
body - The segment body to cache.

remove

public static void remove(SegmentHeader header)
Removes a segment from the cache. Returns true or false if the operation succeeds.

To adjust timeout values, set the MondrianProperties.SegmentCacheWriteTimeout property.

Parameters:
header - A header to remove in the segment cache.

flush

public static void flush(SegmentHeader.ConstrainedColumn[] region)
Flushes a segment from the cache. Returns true or false if the operation succeeds.

To adjust timeout values, set the MondrianProperties.SegmentCacheWriteTimeout property.

Parameters:
region - A region to flush from the segment cache.

getSegmentHeaders

public static List<SegmentHeader> getSegmentHeaders()
Returns a list of segments present in the cache.

If no cache is configured or there is an error while querying the cache, an empty list is returned none the less. To adjust timeout values, set MondrianProperties.SegmentCacheScanTimeout

Returns:
Either a list of header objects or an empty list if there was no cache configured or no segment could be found

isCacheEnabled

public static boolean isCacheEnabled()

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads