This is a simple example that demonstrates loading values using a CacheLoader. Invoking Region.get() causes the CacheLoader to produce a value that is stored in the region. This approach is commonly used to fetch data from other systems like a database.
This example assumes you have installed Java and Geode.
From the geode-examples/loader directory, build the example and run unit tests
$ ../gradlew build
Next start the locator and two servers
$ gfsh run --file=scripts/start.gfsh
Run the example to load the entries
$ ../gradlew run
The example fetches the entries twice. The first retrieval is slow, simulating a network call. Subsequent retrievals are much faster since the values are stored in the cache. The loader logs requests into the Geode server logs. You can find those at build/server1/server1.log or build/server2/server2.log.
Shut down the system:
$ gfsh run --file=scripts/stop.gfsh