To work properly global caching system support requires several enhancements in the openmrs-core:
1) ehcache lib v2.x, I use v2.1.0 but there is 2.2.0 already released;
2) extending Serializable interface to several org.openmrs.logic interfaces (interfaces: Operand, Operator, LogicCriteria, LogicTransform, Rule). I need this because a disk store of the caching framework may be used;
3) I added hashCode method to the Result class - I need this because I cache result of the LogicContext#eval method which is the Result class object;
4) I added getPatientsCount() to the LogicService interface - there is a web page to configure logic caches, I added checking of the cache size of org.openmrs.logic.defaultCache which is used in the LogicContext#eval and LogicContext#read methods and if cache size is too small I show warning message. At_least_cache_size depends on count of patients in the data base. I think we need this because if cache size will be too small there are possible situations of working logic service like with out cache, e.g. when cohort size bigger then cache size.