GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — geode-examples/expiration at develop · apache/geode-examples

Expand file tree

/

expiration

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

expiration

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
scripts
scripts
 
 
src/main/java/org/apache/geode_examples/expiration
src/main/java/org/apache/geode_examples/expiration
 
 
README.md
README.md
 
 

README.md

Outline

Geode Expiration Example

This is a simple example that demonstrates expiration of entries from a region. This can be used to prevent stale entries from lingering in a region. This also allows control over the system resources consumed by any given region.

A region is a collection of entries which are tuples of key and value. When statistics-gathering is enabled, the region maintains access and modification times for each entry. With entry expiration configured, the region will enforce time-to-live limits on entries. When the time since access or modification exceeds the configured duration, the region will take an action to expire the entry. The region can either destroy expired entries in their entirety or invalidate expired entries by removing their values.

This example creates a region where the entries are destroyed after ten seconds without being updated. The example first puts ten random integers into the region. Then the example loops, printing the number of entries in the region, until the region is empty.

This example assumes you have installed Java and Geode.

Steps

  1. From the geode-examples/expiration directory, build the example and run unit tests.

     $ ../gradlew build
    
  2. Next start a locator, start a server, and create a region.

     $ gfsh run --file=scripts/start.gfsh
    
  3. Run the example to demonstrate expiration.

     $ ../gradlew run
    
  4. Shut down the system.

     $ gfsh run --file=scripts/stop.gfsh
    
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.