PHP Code stuck in Cache [Memcached] [closed]

So any suggestions are welcomed.

Suggestion #1 – Whenever Memcache is available in the server, I prefer Memcached Object Cache and Batcache, unless I have a specific reason to use W3 Total Cache. Whatever, W3 Total Cache offers, can be achieved without it too. For example, for minify, we have Better WP Minify, For Varnish, there is WordPress Varnish. For Cloudflare integration, there is a plugin too.

my site is on a dedicated Nginx webserver. I used W3 Total Cache for
the initial caching setup. Everything was set up to cache through
Memcached.

Suggestion #2. Switch to “Page Cache” in Disk: Enhanced mode. Setting up W3 Total Cache with Nginx may look tricky, but easy once we understand how it’s done. Let me share how to do this. Usually, W3 Total Cache creates a file named nginx.conf in the /path/to/wordpress/installation. So, your Nginx’s vhost would be like…

server {
  server_name domain.com;
  root /path/to/wordpress/installation;
  index index.php;

  # W3 Total Cache configuration should be included here
  # if not, W3TC may not work and may only complain
  include $document_root/nginx.conf;

  # [...] all other stuff such as ...
  # location ~ \.php$ { } block
  # location \ { } block
}

Please note, whenever you change something in the W3 Total Cache configuration (via WordPress backend), the Nginx server must be reloaded like nginx -t && service nginx reload (I know it’s crazy, but that’s how we could make the changes to take effect). So, it is recommended to set it up and forget it. W3TC’s Page Cache just works with Nginx.

I’m sorry, I couldn’t answer your original concern (PHP Code stuck in Cache [Memcached])