Memcached and Redis 504 error

Hi,

I’m trying to configure an object Cache on my WordPress website, I tried both Redis and Memcached.

1st attempt:

When I connect to the Redis using Redis Object Cache plugin suddenly website become unresponsive and throws an 504 error.

After deleting Redis Object Cache plugin the 504 error fixed.

2nd attempt:

I had configured memcached on my server, installed Memcached is your friend plugin and I had added “extension=memcached.so” to the last line of php.ini file and restarted my server. Suddenly website became unresponsive and throws an 504 error.

when I removed “extension=memcached.so” from php.ini file and restarted my server the 504 error resolved.

Do someone knows what’s happening why this 504 is appearing? Why I’m unable to configure any object cache on my website?