Added condition, if memcache is enabled, to every function.