add query caching using memcache

This is the memcache query caching that @hpainter did in the ActiveRecord version we had rolled into the framework.  Porting it into our AR fork.