JBoss.org Community Documentation

10.1.3.2. Data Versioning

Optimistic locking makes use of the DataVersion interface (and an internal and default DefaultDataVersion implementation to keep a track of node versioning. In certain cases, where cached data is an in-memory representation of data from an external source such as a database, it makes sense to align the versions used in JBoss Cache with the versions used externally. As such, using the options API , it is possible to set the DataVersion you wish to use on a per-invocation basis, allowing you to implement the DataVersion interface to hold the versioning information obtained externally before putting your data into the cache.