Closed schuob closed 8 years ago
Hi @schuob!
There are a lot of things that can impact this. For each page request, Purgely examines the global $wp_query
object for post IDs related to the current request. If the post ID is in the current main query, the key corresponding to the post is added to the surrogate key list.
I have a few questions for you:
@tollmanz thanks for checking in
Are you seeing any surrogate keys added to the homepage? If yes, do they correspond to the posts on the page?
So after I make a new post here is the surrogate-key for the homepage
curl -svo /dev/null http://stevenchuob.asuscomm.com/
* Trying 98.210.217.69...
* Connected to stevenchuob.asuscomm.com (98.210.217.69) port 80 (#0)
> GET / HTTP/1.1
> Host: stevenchuob.asuscomm.com
> User-Agent: curl/7.48.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 15 Jun 2016 18:40:59 GMT
< Server: Apache/2.4.10 (Raspbian)
< Surrogate-Key: post-60 post-55 post-52 post-49 post-44 post-40 post-37 post-34 post-31 post-9 template-home
< Surrogate-Control: max-age=3600
< Cache-Control: stale-while-revalidate=10
< Cache-Control: stale-if-error=86400
< Link: <http://www.stevenchuob.tk/wp-json/>; rel="https://api.w.org/"
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<
{ [976 bytes data]
* Connection #0 to host stevenchuob.asuscomm.com left intact
post-60
represents the new post I made. I added some debug so here is what Purgely is doing after I added this new post.
Purgely Purge Log : 2016/06/15 (Wed) 18:38:25 https://api.fastly.com/service/3Th8Drsnfr220zDbyqUTgY/purge/post-60 Array
(
[headers] => Array
(
[content-type] => application/json
[content-length] => 47
[accept-ranges] => bytes
[date] => Wed, 15 Jun 2016 18:38:25 GMT
[x-varnish] => 418490055
[via] => 1.1 varnish
[connection] => close
)
[body] => {"status": "ok", "id": "230-1465979820-62972"}
Are you doing anything special on your homepage outside of displaying the latest posts? Frequently, homepages utilize custom queries to pull in collections of posts outside the latest posts. If you are doing this, those post IDs will not be included in the surrogate keys. The plugin has no awareness of custom functionality so it cannot add those for you. If this is the case for you, there is a method for adding additional keys and I can help you with that.
i'm using a free theme that display all the post including the latest one.
Regards, Steven
Thanks @schuob! I talked this over with Simon from Fastly and there is another condition that needs to be handled here. He is going to start work on a patch.
@tollmanz yup - I worked with simon on it already we got this squared away. By the way I am also from Fastly. Thanks for this plugin it's been awesome working with it on my wordpress install.
--Steven
Haha...I did not realize that you were with Fastly. Please let me know of any issue you might experience.
When adding a new post Purgely does not purge the homepage.
https://api.fastly.com/service/<service-id>/purge/post-52
post-52
.