Package org.openspaces.core.map
Class LocalCacheSupport
java.lang.Object
org.openspaces.core.map.LocalCacheSupport
A bean holding local cache support (when using Map API) configuration.
- Author:
- kimchy
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the eviction strategy for the local cache.intIf set toSpaceURL.UPDATE_MODE_PULL(1) each update triggers an invalidation event at every cache instance.intSets the size limit of the local cache.booleanWhen performing a put operation, you may perform the put operation both into the local cache and the master space.booleanControls if this local cache will be versioned or not.voidsetEvictionStrategy(EvictionStrategy evictionStrategy) Sets the eviction strategy for the local cache.voidsetPutFirst(boolean putFirst) When performing a put operation, you may perform the put operation both into the local cache and the master space.voidsetSizeLimit(int sizeLimit) Sets the size limit of the local cache.voidsetUpdateMode(int localCacheUpdateMode) If set toSpaceURL.UPDATE_MODE_PULL(1) each update triggers an invalidation event at every cache instance.voidsetUpdateModeName(String localCacheUpdateModeName) Allows to set the local cache update mode using a descriptive name instead of integer constants usinglocalCacheUpdateMode.voidsetVersioned(boolean versioned) Controls if this local cache will be versioned or not.
-
Field Details
-
LOCAL_CACHE_UPDATE_MODE_PUSH
- See Also:
-
LOCAL_CACHE_UPDATE_MODE_PULL
- See Also:
-
-
Constructor Details
-
LocalCacheSupport
public LocalCacheSupport()
-
-
Method Details
-
setVersioned
public void setVersioned(boolean versioned) Controls if this local cache will be versioned or not. Note, when settings this totrue, make sure that the actual space is versioned as well. -
isVersioned
public boolean isVersioned()Controls if this local cache will be versioned or not. Note, when settings this totrue, make sure that the actual space is versioned as well. -
setEvictionStrategy
Sets the eviction strategy for the local cache. -
getEvictionStrategy
Sets the eviction strategy for the local cache. -
setUpdateMode
public void setUpdateMode(int localCacheUpdateMode) If set toSpaceURL.UPDATE_MODE_PULL(1) each update triggers an invalidation event at every cache instance. The invalidate event marks the object in the local cache instances as invalid. Therefore, an attempt to read this object triggers a reload process in the master space. This configuration is useful in cases where objects are updated frequently, but the updated value is required by the application less frequently.If set to
SpaceURL.UPDATE_MODE_PUSH(2) the master pushes the updates to the local cache, which holds a reference to the same updated object.- See Also:
-
getLocalCacheUpdateMode
public int getLocalCacheUpdateMode()If set toSpaceURL.UPDATE_MODE_PULL(1) each update triggers an invalidation event at every cache instance. The invalidate event marks the object in the local cache instances as invalid. Therefore, an attempt to read this object triggers a reload process in the master space. This configuration is useful in cases where objects are updated frequently, but the updated value is required by the application less frequently.If set to
SpaceURL.UPDATE_MODE_PUSH(2) the master pushes the updates to the local cache, which holds a reference to the same updated object.- See Also:
-
setUpdateModeName
Allows to set the local cache update mode using a descriptive name instead of integer constants usinglocalCacheUpdateMode. Accepts eitherpushorpull.- See Also:
-
setPutFirst
public void setPutFirst(boolean putFirst) When performing a put operation, you may perform the put operation both into the local cache and the master space. This will speed up subsequent get operations. Default totrue. -
isPutFirst
public boolean isPutFirst()When performing a put operation, you may perform the put operation both into the local cache and the master space. This will speed up subsequent get operations. Default totrue. -
setSizeLimit
public void setSizeLimit(int sizeLimit) Sets the size limit of the local cache. Default to100000. -
getSizeLimit
public int getSizeLimit()Sets the size limit of the local cache. Default to100000.
-