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 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.
 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

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


addItem

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


addItem

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


getItem

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


getItem

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


containsItem

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


containsItem

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


hollowItem

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


hollowItem

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


removeItem

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


removeItem

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


clear

public boolean clear()
Clear the whole cache


getDataVolume

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


getFirstIndexTime

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


getLastIndexTime

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


getFirstDataTime

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


getLastDataTime

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


setPolicy

public CachePolicy setPolicy(CachePolicy policy)
Set the cache policy.

Returns:
the old cache policy

getPolicy

public CachePolicy getPolicy()
Get the current cache policy.