flashcache.README.html Maven / Gradle / Ivy
vFabric™ GemFire®
flashcache
Java Caching API Programming Example
The flashcache example is an interactive command-line
application that looks up NASDAQ stock symbols and displays current
quote information. A cache loader, QuoteLoader, is used to read
quotes from quotes.nasdaq.com and cache them in the distributed cache
for quicker access. The example is located in the GemFire installation
under examples/dist/flashcache
Before running this application, you need to configure your environment
according to the instructions provided under the GemFire installation
in examples/EnvSetup.html.
Once your environment is set, change to the examples/dist/flashcache
directory to run the application.
The application prompts for a NASDAQ stock symbol. Enter a symbol, such
as SUNW, to request a quote. Enter no symbol to exit. The cached
quotes are distributed to other GemFire caches connected to the same
distributed system. Optimistic distribution is used, so there is no
locking or acknowledgment of updates, and quotes are distributed
asynchronously. Here is a sample run, with command input in bold:
$ java flashcache.Quote
Enter symbol: ORCL
(QuoteLoader netSearching for ORCL)
(QuoteLoader querying nasdaq for ORCL)
ORCL: last sale=9.85 net change=-0.34 volume=26,526,419
Enter next symbol: AMZN
(QuoteLoader netSearching for AMZN)
(QuoteLoader querying nasdaq for AMZN)
AMZN: last sale=36.37 net change=-0.19 volume=5,668,938
Enter next symbol:
$ java flashcache.Quote