Way back in January, I released the first Alpha build of DataMgr 2.2 (I still can't believe how long I have let development stretch out). In the announcement for that build, I mentioned a new experimental feature called "SmartCache", but I never explained what it was.
Before I explain what SmartCache is, I should point out that it is only available in ColdFusion 8 and above.
SmartCache is best in situations where all of the data changes to a database are happening through DataMgr (though it can work when other data changes are made from ColdFusion). It also makes sense in systems where data is retrieved far more frequently than it is updated.
To enable SmartCache, pass a SmartCache argument to the init() method with a value of true.
Once SmartCache is enabled, DataMgr will track when data is changed in the database. If DataMgr is asked to run a query that it has already run since the last change to data, it will just get the query from cache instead. This will save a trip to the database and enable quicker execution.
If any data has changed since the last time the query has run, it will run the query again. This is done universally rather than by table since any query could reference multiple tables by use of relation fields or custom SQL.
Internally, DataMgr calls the setCacheDate() function any time that it performs an operation that could change data in the database. If you make any data changes outside of DataMgr, you can just call the setCacheDate() (no arguments needed) to tell DataMgr about the change.
This is still experimental, but for some systems has the potential to provide some real performance improvements.