Removed local cache variable
Refactored the way Memcache or Memcached is selected
Added class exists check
Set proper client_type value