|Getting Started with Pivotal GemFire / QuickStart Examples|
Eviction controls your data region size by removing least recently used (LRU) entries to make way for new data.
You can use eviction to control how much heap your data regions use. It kicks in when your data region reaches a specified size or entry count. Size can be absolute or a percentage of your application's current heap.
In this example, the data region is configured to keep the entry count at 10 or below by destroying LRU entries. A cache listener installed on the region reports the changes to the region entries.
In a single session, run the example:
$ java quickstart.DataEviction
Program and cache configuration source files for the example, including the listener declared in the DataEviction.xml file:
|DataEviction.xml||Configures a region to destroy entries when the region reaches a certain capacity. Includes a listener to report on the activity.|
|DataEviction.java||Demonstrates data eviction by adding more entries than the cache is configured to hold.|
|SimpleCacheListener.java||A CacheListener that reports cache events.|