org.objectweb.perseus.cache.api
Interface CacheAttributeController

All Known Implementing Classes:
BasicCacheManager

public interface CacheAttributeController

This interface is management-related. Application code should not use this interface. Further, this interface is intended to be used by service tuning through Ping provided tools. This is the first draft for the this interface and it is likely to evolve.

Author:
Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr)

Field Summary
static int NO_LIMIT
           
 
Method Summary
 java.lang.String getAutoCleanSize()
           
 java.lang.String getAutoCleanThreshold()
           
 java.util.Collection getCurrentEntryIdentifiers()
           
 int getCurrentMemorySize()
           
 int getCurrentSize()
           
 int getMaxObjects()
          This method retrieves the maximum number of objects to be held by the cache.
 int getMemorySize()
          This method returns the maximum main-memory size allocated to the cache.
 void setAutoCleanSize(java.lang.String size)
          Assignes the number of element which can be removed when the cache is full.
 void setAutoCleanThreshold(java.lang.String size)
          Assignes the cache size value since the cache try to decrease the number of entries.
 void setMaxObjects(int size)
          This method allows to set the maximum number of objects to be held by the cache manager.
 void setMemorySize(int size)
          This method allows to set the maximum main-memory size allocated to the cache.
 

Field Detail

NO_LIMIT

public static final int NO_LIMIT
See Also:
Constant Field Values
Method Detail

setMaxObjects

public void setMaxObjects(int size)
                   throws java.lang.IllegalArgumentException,
                          CacheException
This method allows to set the maximum number of objects to be held by the cache manager. However, the actual capacity of the cache depends on the Java Virtual Machine memory limits (and eventually by the amount of disk allocated). That is, if the application allocates a lot of large objects, and the memory limit is reached, the cache would not be able to hold more objects. The cache replacement task is launched when the maximum number of objects limit is nearly to be reached.

Parameters:
size - The maximum number of objects to be held in cache. (It must be a positive number).
Throws:
java.lang.IllegalArgumentException - if the size is invalid (e.g. negative).
CacheException - if it is not possible to reduce the cache size because all entries are fixed.

getMaxObjects

public int getMaxObjects()
This method retrieves the maximum number of objects to be held by the cache.


setMemorySize

public void setMemorySize(int size)
                   throws java.lang.IllegalArgumentException
This method allows to set the maximum main-memory size allocated to the cache. The size is limited by the actual amount of memory allocated to the Java Virtual Machine.

Parameters:
size - The maximum memory size. (It must be a positive number).
Throws:
java.lang.IllegalArgumentException - if the size is invalid (e.g. negative).

getMemorySize

public int getMemorySize()
This method returns the maximum main-memory size allocated to the cache.


setAutoCleanSize

public void setAutoCleanSize(java.lang.String size)
Assignes the number of element which can be removed when the cache is full. This value can be an absolute value( ex: "124") or a percent of the maximal cache size ("8%").


getAutoCleanSize

public java.lang.String getAutoCleanSize()

setAutoCleanThreshold

public void setAutoCleanThreshold(java.lang.String size)
Assignes the cache size value since the cache try to decrease the number of entries. This value can be an absolute value( ex: "124") or a percent of the maximal cache size ("8%").


getAutoCleanThreshold

public java.lang.String getAutoCleanThreshold()

getCurrentSize

public int getCurrentSize()
Returns:
an positive integer value. It is the current size of the cache in term of object number currently managed by the cache.

getCurrentMemorySize

public int getCurrentMemorySize()
Returns:
an positive integer value. It is the current size of the cache in octets. This size matches to the memory foot print of the entries set managed by the cache.

getCurrentEntryIdentifiers

public java.util.Collection getCurrentEntryIdentifiers()
Returns:
an unmodifiable collection containing the identifiers of current cache entries.


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.