How to force W3TC Page Cache using Disk Enhanced to cache latest posts/custom rules [closed]
Have been using W3TC since 6 years now on my WordPress blog. Never faced an issue apart from this one below:
I had set Page Cache to Disk Enhanced and it was working great until one day my website refused to open. Upon inspection, I realized that the cache folder
/var/www/domain.com/htdocs/wp-content/cache was ~950GB and my server disk space was 950GB. So it had basically eaten up all disk space, not allowing other services to run properly.
A bit of context: My site is 6 years old. Have 24,000 posts and 100GB of
48GB RAM 960GB SSD drive 12 core processor LEMP stack
So W3TC was caching all my articles (even from 2014, 2015 etc) as per my sitemap. Upon more inspection, I realized that it takes sitemap priority to build the cache over time. But in my case it made little sense as my website is a news site. And news from last year or last month is already stale and I don’t get a lot of visits on those.
So is there a way, we can add rules to nginx so that disk enhanced caches most recent articles (say latest till last 2 weeks) and maybe if someone accesses an old post (say from last year) the page is cached.
I have full access to my server, can make nginx entries. Since I didn’t know what rules to enter, I switched from disk enhanced to Memcache for Page Caching (size 4GB), but it’s very slow compared to Disk Enhanced. It was the best.
Can someone please guide me.