Package org.hcjf.cloud.cache
Class SizeStrategy
- java.lang.Object
-
- org.hcjf.cloud.cache.SizeStrategy
-
- All Implemented Interfaces:
CloudCacheStrategy
public class SizeStrategy extends java.lang.Object implements CloudCacheStrategy
This strategy maintains the size of the internal storage.- Author:
- javaito
-
-
Constructor Summary
Constructors Constructor Description SizeStrategy(java.lang.Integer size)
-
Method Summary
Modifier and Type Method Description java.util.Set<java.lang.Object>applyStrategy()This method must evaluate the specific strategy and return all the ids that will be removed of the cache implementation.voidinit(CloudCache cacheInstance)This method initialize the distributed map to maintains the size of the cache.voidonAdd(java.lang.Object id, java.lang.Object value)Add a new id into the internal collection.voidonRemove(java.lang.Object id)Remove a specific id of the internal collection.
-
-
-
Method Detail
-
init
public void init(CloudCache cacheInstance)
This method initialize the distributed map to maintains the size of the cache.- Specified by:
initin interfaceCloudCacheStrategy- Parameters:
cacheInstance- Instance of cache.
-
onRemove
public void onRemove(java.lang.Object id)
Remove a specific id of the internal collection.- Specified by:
onRemovein interfaceCloudCacheStrategy- Parameters:
id- Id removed to the cache instance.
-
onAdd
public void onAdd(java.lang.Object id, java.lang.Object value)Add a new id into the internal collection.- Specified by:
onAddin interfaceCloudCacheStrategy- Parameters:
id- Id added into the cache instance.value- Value added into cache.
-
applyStrategy
public java.util.Set<java.lang.Object> applyStrategy()
This method must evaluate the specific strategy and return all the ids that will be removed of the cache implementation.- Specified by:
applyStrategyin interfaceCloudCacheStrategy- Returns:
- Collection of the ids that will be removed.
-
-