Package com.kheops.util
Class KObjectCache
java.lang.Object
com.kheops.util.KObjectCache
A class used to store and retrieve data stored on memory.
- 
Constructor SummaryConstructorsConstructorDescriptionKObjectCache(int maximumSize) Constructs a KMemoryDataCache with the specified maximum size
- 
Method SummaryModifier and TypeMethodDescriptionbooleanChecks if the table contains the data with the specified keyslongGets the memory cache current sizedoubleThis method returns the sucessfull retrieval data count over the number of retrieval attemps It enables to get statistic of the retrieve methodlongGets the memory cache maximum allowed sizevoidRemoves the memory cache with the specified keyRetrieves the data previously stored using the specified key.voidStores the specified object in memory cache using the specified key.
- 
Constructor Details- 
KObjectCachepublic KObjectCache(int maximumSize) Constructs a KMemoryDataCache with the specified maximum size- Parameters:
- maximumSize- the maximum number of objects the cache can contain
 
 
- 
- 
Method Details- 
storeStores the specified object in memory cache using the specified key.- Parameters:
- key- the key of the KMemoryDataCache where to store the data
- object- the object to be stored
 
- 
retrieveRetrieves the data previously stored using the specified key. If the data does not exist, no exception is thrown but the method returns null.- Parameters:
- key- unique identifier used to search for the corresponding data
- Returns:
- data the data retrieved from memory
 
 this method keeps the count of sucessfull and unsecessfull data retrieval
 
- 
containsChecks if the table contains the data with the specified keys- Parameters:
- key- the corresponding key
- Returns:
- the boolean value of the result
 
- 
getCurrentSizepublic long getCurrentSize()Gets the memory cache current size- Returns:
- the current cache size
 
- 
getMaximumSizepublic long getMaximumSize()Gets the memory cache maximum allowed size- Returns:
- the maximum cache size
 
- 
removeRemoves the memory cache with the specified key- Parameters:
- key- the key of the data to be removed
 
- 
getEfficiencypublic double getEfficiency()This method returns the sucessfull retrieval data count over the number of retrieval attemps It enables to get statistic of the retrieve method- Returns:
- the effeciency ratio
 
 
-