mondrian.rolap.agg
Interface SegmentCache


public interface SegmentCache

SPI definition of the segments cache.

Lookups are performed using SegmentHeaders and SegmentBodys. Both are immutable and fully serializable.

Implementations are expected to be thread-safe. It is the responsibility of the cache implementation to maintain a consistent state.

Implementations must provide a default empty constructor. Segment caches are instantiated as a singleton but can be hot swapped by modifying MondrianProperties.SegmentCache. Implementations will get a termination signal through tearDown() but Mondrian will relinquish control of the termination thread and will not be listening to thrown exceptions.

Author:
LBoudreau
See Also:
MondrianProperties.SegmentCache
 

Method Summary
 Future<Boolean> contains(SegmentHeader header)
          Checks if the cache contains a SegmentBody corresponding to the supplied SegmentHeader.
 Future<SegmentBody> get(SegmentHeader header)
          Returns a future SegmentBody object once the cache has returned any results, or null of no segment corresponding to the header could be found.
 Future<List<SegmentHeader>> getSegmentHeaders()
          Returns a list of all segments present in the cache.
 Future<Boolean> put(SegmentHeader header, SegmentBody body)
          Stores a segment data in the cache.
 void tearDown()
          Tear down and clean up the cache.
 

Method Detail

get

Future<SegmentBody> get(SegmentHeader header)
Returns a future SegmentBody object once the cache has returned any results, or null of no segment corresponding to the header could be found.

Parameters:
header - The header of the segment to find. Consider this as a key.
Returns:
A Future SegmentBody or a Future null if no corresponding segment could be found in cache.

contains

Future<Boolean> contains(SegmentHeader header)
Checks if the cache contains a SegmentBody corresponding to the supplied SegmentHeader.

Parameters:
header - A header to lookup in the cache.
Returns:
A Future true or a Future false if no corresponding segment could be found in cache.

getSegmentHeaders

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

Returns:
A List of segment headers describing the contents of the cache.

put

Future<Boolean> put(SegmentHeader header,
                    SegmentBody body)
Stores a segment data in the cache.

Parameters:
header - The header of the segment.
body - The segment body to cache.
Returns:
A Future object which returns true or false depending on the success of the caching operation.

tearDown

void tearDown()
Tear down and clean up the cache.


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