Book Image

Infinispan data grid platform definitive guide

Book Image

Infinispan data grid platform definitive guide

Overview of this book

Table of Contents (20 chapters)
Infinispan Data Grid Platform Definitive Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Reading and writing through cache


In this pattern, application treats the cache as the main data store for read and write operations. The cache is responsible for reading and writing to an underlying resource.

Read-Through looks like the structure of the cache-aside pattern for read operations, the difference is on how the system behaves in the data changes. After retrieving the data from a data store and when data is not found in the cache, the cache updates itself and returns the data to the calling application.

In the Write-Through mode, if the client change the cache content by invoking a write operation, for instance, using the put() or putAll() methods, Infinispan will not return the call to the client until Infinispan finishes updating the underlying cache store. This means that the client thread will be blocked until all updates are written to the cache store, which can result in a very expensive operation.

A graphical representation of this pattern is illustrated in the following...