public interface

Cache

com.microstrategy.utils.cache.Cache
Known Indirect Subclasses

Class Overview

Cache interface. Cache is a collection of objects that are loaded from the persistent storage and cached in the memory.

Summary

Public Methods
abstract void clear()
Clears the cache - all entries are removed.
abstract void close()
Un-register cache from the cache registry.
abstract boolean contains(CacheHint hint)
abstract void delete(CacheHint hint)
Removes object from the cache and persistent storage
abstract Object get(CacheHint hint)
Finds and returns cached object based on the hint.
abstract String getName()
Returns cache name.
abstract void onHintClose(CacheHint hint)
This method is supposed to be called by the hint object when it is closed.
abstract void put(CacheHint hint, Object ob)
Puts the object in the cache.
abstract Object refresh(CacheHint hint)
Re-loads object from the persistent storage
abstract void remove(CacheHint hint)
Removes an object from the cache.
abstract void save(CacheHint hint, Object ob)
Puts the object in the cache and stores it in the memory.

Public Methods

public abstract void clear ()

Clears the cache - all entries are removed.

public abstract void close ()

Un-register cache from the cache registry. Cache shall not be used after this call.

public abstract boolean contains (CacheHint hint)

public abstract void delete (CacheHint hint)

Removes object from the cache and persistent storage

Parameters
hint the hint object.
Throws
CacheException if attempt to extract key from the hint failed or if attempt to remove obect from the persistent storage failed

public abstract Object get (CacheHint hint)

Finds and returns cached object based on the hint. If object does not exists in the memory it will be loaded from the persistent memory. Returns null if object does not exists in persistent memory either.

Parameters
hint the hint object.
Returns
  • cached object.
Throws
CacheException if attempt to load object from the persistent memory faild with exception

public abstract String getName ()

Returns cache name.

Returns
  • cache name.

public abstract void onHintClose (CacheHint hint)

This method is supposed to be called by the hint object when it is closed. Cache implementations shall use this call to perform proper cache cleanup.

Parameters
hint the hint object.

public abstract void put (CacheHint hint, Object ob)

Puts the object in the cache. If cache already contains object corresponding to the specified hint it will be replaced with the new one.

Parameters
hint the hint object.
ob object to be cached
Throws
CacheException if attempt to extract key from the hint failed

public abstract Object refresh (CacheHint hint)

Re-loads object from the persistent storage

Parameters
hint the hint object.
Returns
  • cached object. Different cache implementations can either re-load data in the existing object or create a new one.
Throws
CacheException if attempt to extract key from the hint failed or if attempt to re-load obect from the persistent storage failed

public abstract void remove (CacheHint hint)

Removes an object from the cache.

Parameters
hint the hint object.
Throws
CacheException Thrown when error occurs during removing the object.

public abstract void save (CacheHint hint, Object ob)

Puts the object in the cache and stores it in the memory. Normally this method will be called after application obtained an object from the cache and modified it. But it is also possible to use this method to replace cached object with another one or to add to the cache and to the persistent storage a new object.

Parameters
hint the hint object.
ob object to be cached
Throws
CacheException if attempt to extract key from the hint failed or if attempt to store obect in the persistent storage failed