implement the cache class to support memcache/memcached/redis