|
Search XAP.NET 7.0
Offline Documentation
Download latest offline documentation in HTML format:
|
Summary: The local cache storage is managed by an eviction strategy. The strategy determines when and if Entries needs to be evicted from the space, and is also in charge of deciding which specific Entries to evict.
Choosing and configuring an eviction strategyXAP.NET comes with a number of eviction strategies. To choose an eviction strategy, you'll need to configure a IdBasedLocalCacheConfig object with the desired eviction strategy builder. A IdBasedLocalCache instance can be created with this config object. Here's a simple example of configuring a cache to use the FIFO eviction strategy, where the size limit of the cache is 50,000 entries and each time an eviction is required, 1,000 Entries are evicted: ISpaceProxy spaceProxy = // create or obtain a reference to a space proxy IdBasedLocalCacheConfig cacheConfig = new IdBasedLocalCacheConfig (); cacheConfig.EvictionStrategyBuilder = new FifoSegmentEvictionStrategyBuilder(50000, 1000); ILocalCache localCache = new GigaSpacesFactory.CreateIdBasedLocalCache(spaceProxy, cacheConfig); Eviction strategies
Each of these strategies also contains a logic for periodic clearing; by default every 30 seconds the local cache is cleared. This behavior can be changed or turned off when constructing and configuring the specific eviction strategy builder, however it is not recommended to turn it off. Custom eviction strategyA custom eviction strategy can be implemented. To do this, you first need to implement an eviction strategy by implementing the IEvictionStrategy interface. Then, implement a builder for it by implementing the ISegmentEvictionStrategyBuilder interface. |
Cache Eviction Strategy
IMPORTANT: This is an old version of GigaSpaces XAP. Click here for the latest version.
(None)
