move memcache up a layer, simplify code