WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
sitemap.xml and sitemap-news.xml not being cached (14 posts)

  1. skippybosco
    Member
    Posted 3 years ago #

    I am using the XML Sitemap & Google News Sitemap Feeds plugin (http://wordpress.org/extend/plugins/xml-sitemap-feed/) for generation of my sitemap.xml and sitemap-news.xml file.

    The sitemaps are being generated successfully, but WP Super Cache is not caching them. Instead of creating a cache file, as I would expect, an empty directory is created under my cache domain directory (/public_html/wp-content/cache/supercache/apopn.com/sitemap.xml/)

    WP Super Cache is caching the rest of my site correctly, just not the sitemap files.

    I am running WordPress 3.2.1, WP Super Cache .9.9.9 and XML Sitemap & Google News Sitemap Feeds 3.9.1

    Any suggestions would be greatly appreciated!

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. RavanH
    Member
    Posted 3 years ago #

    You need to check the option "Late init" in WP Super Cache to get the feed cached. This works even in mod_rewrite mode so - as I understand it - the performance of normal posts/pages should not be affected.

  3. RavanH
    Member
    Posted 3 years ago #

    By the way, checking late init seems necessary for all feeds (not just the sitemap feed) to be cached but it is not documented as far as I know... Donncha?

  4. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    skippybosco - use the debug system in the plugin to figure out why the sitemaps aren't caching.

    RavanH - you shouldn't need to enable late init. I think there may be some issue with feeds. I'll have to check.

  5. skippybosco
    Member
    Posted 3 years ago #

    Thanks for the responses guys.

    @RavanH: Late Init does not seem to change anything for me.

    @Donncha: I ran debug with two loads of the sitemap.xml:

    First Request:

    01:11:43 /sitemap.xml supercache dir: /home/domain/public_html/wp-content/cache/supercache/domain.com/sitemap.xml/
    01:11:43 /sitemap.xml No wp-cache file exists. Must generate a new one.
    01:11:43 /sitemap.xml In WP Cache Phase 2
    01:11:43 /sitemap.xml Setting up WordPress actions
    01:11:43 /sitemap.xml Created output buffer
    01:11:45 /sitemap.xml Output buffer callback
    01:11:45 /sitemap.xml Supercache disabled: GET or feed detected or disabled by config.
    01:11:45 /sitemap.xml Writing non-gzipped buffer to wp-cache cache file.
    01:11:45 /sitemap.xml Renamed temp wp-cache file to /home/domain/public_html/wp-content/cache/wp-cache-d8d99752c11a1403b6cd78bb357c1552.html
    01:11:45 /sitemap.xml Sending buffer to browser
    01:11:45 /sitemap.xml wp_cache_shutdown_callback: collecting meta data.
    01:11:45 /sitemap.xml Writing meta file: /home/domain/public_html/wp-content/cache/meta/wp-cache-d8d99752c11a1403b6cd78bb357c1552.meta
    01:11:50 /sitemap.xml wp-cache file exists: /home/domain/public_html/wp-content/cache/wp-cache-d8d99752c11a1403b6cd78bb357c1552.html
    01:11:50 /sitemap.xml Serving wp-cache static file
    01:11:50 /sitemap.xml exit request

    Second Request:

    01:12:27 /sitemap.xml wp-cache file exists: /home/domain/public_html/wp-content/cache/wp-cache-d8d99752c11a1403b6cd78bb357c1552.html
    01:12:27 /sitemap.xml Serving wp-cache static file
    01:12:27 /sitemap.xml exit request

    Cache file was at a different location than I expected, probably because it is being cached, but not super cached.

    1. Is it possible to have the sitemap/feed files supercached?

    2. This is a great example of where it would be nice to be able to set different expiration dates for different types of content (http://wordpress.org/support/topic/different-expiration-times-for-different-types-of-content?replies=1). Posts may expire @ 300 sec whereas our sitemap files can live as long as 3600 sec.

  6. RavanH
    Member
    Posted 3 years ago #

    Hi Donncha, what I had noticed is that without late init checked, the feed timestamps change on each request whereas with late init, the timestamps remain the same. On the other hand, with late init, there is no Last-Modified response header...

    In both cases, response headers show:

    Expires:	Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control:	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma:	no-cache

    even though I have checked the option 304 Not Modified browser caching.

    Is it best to ignore the differences in date stamps and trust the Last-Modified header to do it's work in spite of the no-cache directive?

    You can see it happening on http://4visions.nl/feed/ where I have WP Super Cache in PHP mode with 304 Not Modified browser caching on and lite init switched off again.

  7. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    I just fixed the code that detects multisite installs and that appears to have fixed caching of the sitemap on my own server. Is your site a multisite one? That may be it.

    Go grab the dev version in about 20 minutes, it should have updated by then!

  8. RavanH
    Member
    Posted 3 years ago #

    Hi Donncha, is the sitemap legacy cached or super cached on your server? On my Multi-site install, all feeds (inlcuding the sitemap feed) are still 'only' legacy cached. Time-stamp behaviour (differing after each request) did not change either. Nor the Expires/Cache-Control/Pragma response headers...

  9. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    Legacy caching only because of the headers required.

    Not sure why it doesn't work for you. That's annoying. I'll have to look at it again when I have a chance.

  10. RavanH
    Member
    Posted 3 years ago #

    No, I spoke too soon and I think because of upgrading without being able to completely clear the cache for all sites in the network (see my other post on this forum) I was looking at old cached files. Could that be it? In any case, now that some time has passed it seems the timestamps stick to on time on every request and on every site...

    Only the Expires/Cache-Control/Pragma response headers remain like before but this time with the extra WP-Super-Cache header:

    Expires:	Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control:	no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma:	no-cache
    WP-Super-Cache:	Served legacy cache file
  11. NaplesFlorida
    Member
    Posted 3 years ago #

    Hi Donncha

    Does your pluggin cache all pages and posts, dynamic and static, in an XML sitemap?

  12. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    NaplesFlorida - it caches whatever pages are visited by visitors, or have been "preloaded" by the plugin.

  13. NaplesFlorida
    Member
    Posted 3 years ago #

    Hi Donncha

    I have over 20,000 dynamic URL's in my sitemap.

    I need the all pages to be pre-cached.
    Is there a way to do that or is it being done already out of the box?

  14. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    You can use the "Preload" functionality of the plugin to cache all those pages ahead of time.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic