{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/453","repository_url":"https://api.github.com/repos/Automattic/wp-super-cache","labels_url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/453/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/453/comments","events_url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/453/events","html_url":"https://github.com/Automattic/wp-super-cache/issues/453","id":273583747,"number":453,"title":"Mark cache files as expired instead of removing","user":{"login":"rob006","id":5972388,"avatar_url":"https://avatars2.githubusercontent.com/u/5972388?v=4","gravatar_id":"","url":"https://api.github.com/users/rob006","html_url":"https://github.com/rob006","followers_url":"https://api.github.com/users/rob006/followers","following_url":"https://api.github.com/users/rob006/following{/other_user}","gists_url":"https://api.github.com/users/rob006/gists{/gist_id}","starred_url":"https://api.github.com/users/rob006/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rob006/subscriptions","organizations_url":"https://api.github.com/users/rob006/orgs","repos_url":"https://api.github.com/users/rob006/repos","events_url":"https://api.github.com/users/rob006/events{/privacy}","received_events_url":"https://api.github.com/users/rob006/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-13T21:27:26Z","updated_at":"2017-11-14T06:35:26Z","closed_at":null,"author_association":"NONE","body":"I have a website with very dynamic content (2-8 posts and hundreds of comments per hour) and high load. I need to clear all cache on post publish/update and use low cache timeout (like 5 minutes) to make sure that public content is not outdated (too much). With traffic at level of 30 RPS removing cache is freezing website for 10-50 seconds. It is mostly because many concurrent requests try to generate the same page, which drains CPU of my server. We could really avoid this if we just mark cache file as expired instead of removing it, and reuse its content for concurrent requests. Then only first request will regenerate page and all concurrent request may serve old content meantime. \r\n\r\nThis could be really simple if plugin will use mtime to store timeout for cache file and check it before using the cache. If cache is expired (`filemtime($filePath) < time()`), touch it by `touch($filePath, time() + 10)` and continue generate fresh page. Meantime all concurrent requests will use old cache for 10 seconds (or till new cache will be generated by first request). When new cache file is generated, we touch it by `touch($filePath, time() + $cacheDuration)` - then it will be valid for next `$cacheDuration` seconds. \r\n\r\nThis should really reduce load spikes for big sites."},"comment":{"url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/comments/344160252","html_url":"https://github.com/Automattic/wp-super-cache/issues/453#issuecomment-344160252","issue_url":"https://api.github.com/repos/Automattic/wp-super-cache/issues/453","id":344160252,"user":{"login":"donnchawp","id":5656673,"avatar_url":"https://avatars0.githubusercontent.com/u/5656673?v=4","gravatar_id":"","url":"https://api.github.com/users/donnchawp","html_url":"https://github.com/donnchawp","followers_url":"https://api.github.com/users/donnchawp/followers","following_url":"https://api.github.com/users/donnchawp/following{/other_user}","gists_url":"https://api.github.com/users/donnchawp/gists{/gist_id}","starred_url":"https://api.github.com/users/donnchawp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donnchawp/subscriptions","organizations_url":"https://api.github.com/users/donnchawp/orgs","repos_url":"https://api.github.com/users/donnchawp/repos","events_url":"https://api.github.com/users/donnchawp/events{/privacy}","received_events_url":"https://api.github.com/users/donnchawp/received_events","type":"User","site_admin":false},"created_at":"2017-11-14T06:35:26Z","updated_at":"2017-11-14T06:35:26Z","author_association":"CONTRIBUTOR","body":"Have you tried the cache rebuild feature? That's what this does, mostly."}}
{"actor":{"display_login":"donnchawp"}}