Model layer allows to declare caching properties associated to model services (within the /app/config/model_services.xml) by using the cache and cache-ttl attributes at service level.
i.e.
<?xml version = "1.0" standalone="yes"?>
<configuration>
<model-services>
<!-- Invoice services -->
<class name="InvoiceDao">
<service name = "getAllInvoices"
class-method = "loadAll"
cache = "true"
cache-ttl = "300"/>
<service name = "getInvoice"
class-method = "load"
cache = "true"
cache-ttl = "60"/>
<service name = "saveInvoice" class-method = "save"/>
</class>
</model-services>
</configuration>
In this example, we are caching the getAllInvoices service to expire after 300 seconds (ttl), as well as the getInvoices with a ttl of 1 minute
Use cache capabilities in model services designed just to return results without altering the model.
Take into account that a cached service won't be executed itself.
The cache-ttlis optional, being 0 by default, forcing the cache to never expire
For more information regarding the model, please see the The Model section.