Hi,
In terms of L2 caching there are 2 almost separate features which is "Bean caching" and "Query caching".
"Bean caching":
---------------------
So "Bean caching" is to support "Find by Id" and "Find by unique natural key" queries. It sounds to me like your application is only going to need "bean caching".
"Query caching"
---------------------
This is where you want to improve the performance of "findList" / "findPagedList" type queries than fetch many beans. It sounds like your application has no need for query caching - your caching requirement is purely for bean get/put by id.
For applications that have a desire/need for "Query caching" ElasticSearch provides a very good solution (and currently there are no other options available out of the box. Alternatives would be a data-grid product where Ebean converts the ORM query into a data-grid query for the data-grid to execute. The issue here is that the data-grid has to compete against the inverted indexes of ElasticSearch and the prediction is that ElasticSearch will simply be way faster).
So at this point your application requirement has no need for "Query caching" so what are the options.
"L2/Near cache and L3/Remote cache"
-----------------------------------------------------
This is somewhat Ebean specific terminology but it is relatively important to distinguish between the "Near cache" and the "Remote cache" part of L2 caching. Specifically the Near cache is in-process and requires no network hop where as a hit against the Remote cache has a network hop.
This brings up:
- Do we want a "Near cache"? (More memory requirement on the Application server vs extra network hop)
- Do we want a "Remote cache" or simply hit the DB? (Your wanting the remote cache part but some might not choose that)
- What can we use as the "Remote cache" for "Bean caching"? (Effectively any Key/value store is a good fit here but note that is not the case for L2 query cache)
"Ebean out of the box"
-----------------------------
Ebean does not have support for using AWS Elasticache out of the box.
What Ebean has out of the box is it's own Near Cache plus ElasticSearch which supports both Bean caching and Query caching.
That is, ElasticSearch can also be seen as a key/value store.
There is an caching API that can be implemented so people can implement that themselves or look to log an enhancement request or look to sponsor a specific implementation.
"Updating the bean cache"
-----------------------------------
ElasticSearch supports updates where Ebean can just give it the (part of the document) that has changed. That is, for an update Ebean does NOT need to give ElasticSearch all the values of the bean (the entire bean document) again but instead only needs to give ElasticSearch the delta (the changes properties). What this means is that with ElasticSearch you can perform updates on a "partially loaded" entity bean.
The question when supporting each key/value store is IF there is an update on a "partially loaded" entity bean can Ebean just send the key/value store the changed properties or does Ebean need to load all the unloaded properties (from the DB) to send the key/value store a new version of the bean.
If an application does not use "partial objects" this does not matter as the beans being updated as always fully loaded but Ebean supports "partial objects" and "stateless updates" and so this question arises as you how well a key/value store supports that (and if not we can get the overhead of fetching the unloaded properties from the DB).