com.timeindexing.cache
Interface IndexCache

All Known Implementing Classes:
DefaultIndexCache, FileIndexCache

public interface IndexCache

The time index itself. The values of the index may or may not be in core. It is up to the implementations to decide how much will be kept in core.


Method Summary
 long addItem(IndexItem item, long position)
          Add an Index Item to the Index.
 long addItem(IndexItem item, Position position)
          Add an Index Item to the Index.
 boolean clear()
          Clear the whole cache
 boolean containsItem(long pos)
          Contains the IndexItem at the speicifed position.
 boolean containsItem(Position p)
          Contains the IndexItem at the speicifed position.
 long decreaseDataVolume(long v)
          Decrease the data volume
 long getDataVolume()
          Get the current data volume held by IndexItems in a cache.
 Timestamp getFirstDataTime()
          Get the time the first IndexItem was put into the Index.
 Timestamp getFirstIndexTime()
          Get the time the first IndexItem was put into the Index.
 IndexItem getItem(long n)
          Get an Index Item from the Index.
 IndexItem getItem(Position p)
          Get an Index Item from the Index.
 Timestamp getLastDataTime()
          Get the time the last IndexItem was put into the Index.
 Timestamp getLastIndexTime()
          Get the time the last IndexItem was put into the Index.
 CachePolicy getPolicy()
          Get the current cache policy.
 boolean hollowItem(long pos)
          Hollow out the IndexItem at the speicifed position.
 boolean hollowItem(Position p)
          Hollow out the IndexItem at the speicifed position.
 long increaseDataVolume(long v)
          Increase the data volume
 boolean removeItem(long pos)
          Remove the IndexItem at the speicifed position.
 boolean removeItem(Position p)
          Remove the IndexItem at the speicifed position.
 CachePolicy setPolicy(CachePolicy policy)
          Set the cache policy.
 long size()
          Get the no of items in the index.
 

Method Detail

size

long size()
Get the no of items in the index.


addItem

long addItem(IndexItem item,
             Position position)
Add an Index Item to the Index.


addItem

long addItem(IndexItem item,
             long position)
Add an Index Item to the Index.


getItem

IndexItem getItem(long n)
Get an Index Item from the Index.


getItem

IndexItem getItem(Position p)
Get an Index Item from the Index.


containsItem

boolean containsItem(long pos)
Contains the IndexItem at the speicifed position. If the cache contains the item, it means it is loaded.


containsItem

boolean containsItem(Position p)
Contains the IndexItem at the speicifed position. If the cache contains the item, it means it is loaded.


hollowItem

boolean hollowItem(long pos)
Hollow out the IndexItem at the speicifed position.


hollowItem

boolean hollowItem(Position p)
Hollow out the IndexItem at the speicifed position.


removeItem

boolean removeItem(long pos)
Remove the IndexItem at the speicifed position.


removeItem

boolean removeItem(Position p)
Remove the IndexItem at the speicifed position.


clear

boolean clear()
Clear the whole cache


getDataVolume

long getDataVolume()
Get the current data volume held by IndexItems in a cache.


increaseDataVolume

long increaseDataVolume(long v)
Increase the data volume

Returns:
the new data volume

decreaseDataVolume

long decreaseDataVolume(long v)
Decrease the data volume

Returns:
the new data volume

getFirstIndexTime

Timestamp getFirstIndexTime()
Get the time the first IndexItem was put into the Index.


getLastIndexTime

Timestamp getLastIndexTime()
Get the time the last IndexItem was put into the Index.


getFirstDataTime

Timestamp getFirstDataTime()
Get the time the first IndexItem was put into the Index.


getLastDataTime

Timestamp getLastDataTime()
Get the time the last IndexItem was put into the Index.


setPolicy

CachePolicy setPolicy(CachePolicy policy)
Set the cache policy.

Returns:
the old cache policy

getPolicy

CachePolicy getPolicy()
Get the current cache policy.



Timeindexing 2008