org.objectweb.perseus.cache.api

Interface CacheAttributeController

All Superinterfaces:
AttributeController
Known Implementing Classes:
BasicCacheManager

public interface CacheAttributeController
extends AttributeController

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

String
getAutoCleanSize()
String
getAutoCleanThreshold()
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(String size)
Assignes the number of element which can be removed when the cache is full.
void
setAutoCleanThreshold(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 Details

NO_LIMIT

public static final int NO_LIMIT

Field Value:
-1

Method Details

getAutoCleanSize

public String getAutoCleanSize()


getAutoCleanThreshold

public String getAutoCleanThreshold()


getCurrentEntryIdentifiers

public Collection getCurrentEntryIdentifiers()

Returns:
an unmodifiable collection containing the identifiers of current cache entries.


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.


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.


getMaxObjects

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


getMemorySize

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


setAutoCleanSize

public void setAutoCleanSize(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%").


setAutoCleanThreshold

public void setAutoCleanThreshold(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%").


setMaxObjects

public void setMaxObjects(int size)
            throws 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:
CacheException - if it is not possible to reduce the cache size because all entries are fixed.


setMemorySize

public void setMemorySize(int size)
            throws 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).


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