The concurrency strategies are the mediators who are responsible for storing items and retrieving them from the cache.In case of enabling a second level cache, the developer must decide for each persistent class and collection, and also which cache concurrency, has to be implemented.
Following are the concurrency strategies that can be implemented by the developer:
-
Transactional: This strategy is used mostly to read data where the prevention of stale data is critical in concurrent transactions, in the unique case of an update.
-
Read- Only: This strategy is compatible with the data that can’t be modified. We can use it for reference data only.
-
Read-Write: It is similar to transactional strategy. where we read mostly data and prevention of stale data is critical.
-
Non-strict-Read-Write: This strategy assures no guarantee of consistency between the database and cache. We can use this strategy only if the data can be modified and a small likelihood of stale data is not the critical concern.