fix #2401: cache for aggregating model methods
added test for aggregating functions' cache
fixed test for aggregate functions
Merge pull request #2640 from maxgalbu/aggregators_cache

Fix aggregate functions cache