Cache as a Query result
Let's say we have too much records into table and we don't want to cache them all. We want to cache just a part of them. Hopefully, Daobab provides easy way to do this.
Every entity list
result() is a cache!
CachedListNow, orderlist is our cache. Make in-memory queries over it. Count at the begginig:
orderlist=Select.from(daoOrderPizza) .whereBetween(daoOrderPizza.colDeliverDate(), fromDate, toDate) .result();
Long uniquePizzasOrdered=Select.from(orderlist).unique().countAny();What pizzas has been ordered? (cache and database table in one query)
orderedpizzanames=Select.fieldList(daoPizza.colName()) .whereSelect(daoPizza.colPizzaId(),Operator.IN, Select.fieldList(orderlist,daoOrderPizza.colPizzaId()).unique()) .result();