Using multiple levels of caching in Cayenne allows to significantly improve performance, reducing the number of trips to the database. There are two things that Cayenne can cache - individual objects and query results (i.e. lists of objects). These two types are handled differently by Cayenne, as described below.
Individual objects are cached by Cayenne by default as they are fetched from the database or created by the user. Such caching is both a performance optimization mechanism and a way to ensure internal object uniquing. Users normally do not need to do anything special for this to work. Still there are a few parameters that can be configured
Out of the box Cayenne provides two implementations of the pluggable cache factory: