WordPress.org

Support

Support » Plugins and Hacks » WP Super Cache isn't caching archive pages correctly

WP Super Cache isn't caching archive pages correctly

  • Hi Donncha,

    I’ve been using WP SuperCache on my WPMU 2.8.4 blog for a while and it works great there. I just upgraded the blog to WP 3.0.2 and noticed some strange behavior in WP SuperCache. FYI, I’m using the mod_rewrite method for WP Super Cache.

    In WP 2.8.4, WP SuperCache would create 2 cached versions of the home page when a user first visited it: /vol/www/www.mysite.com/blog/index.html and /vol/www/www.mysite.com/blog/index.html.gz. So the next time a user loaded the home page, Apache would just load the HTML or, even better, the gzipped HTML from the cached files.

    Since we’ve upgraded to WP 3.0.2 and upgraded WP Super Cache to the latest version, the webserver isn’t creating the correct cached HTML pages for the home page. Rather than creating /vol/www/www.mysite.com/blog/index.html and /vol/www/www.mysite.com/blog/index.html.gz, the webserver is creating 2 temp files each time it loads the page. Here are some examples: /vol/www/www.mysite.com/blog/10081128374cf92a47699b86.32924954.tmp and /vol/www/www.mysite.com/blog/10081128374cf92a47699b86.32924954.tmp.gz.

    This behavior causes 2 problems. First, the home page loads more slowly. Second, and perhaps even more importantly, my cache directory is quickly getting filled with useless files that may ultimately create some kind of problem with the linux server.

    FYI, WP Super Cache seems to be working just fine in creating the cached versions of articles or custom pages. The only problem seems to be with archive pages such as the home page.

    Any help you could provide would be greatly appreciated!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Donncha O Caoimh
    Member

    @donncha

    Enable debugging in the plugin and that should tell you why the files aren’t being created. When Supercache can’t rename the temp files it should delete them so there’s something really weird going on.

    Hi Donncha,

    I enabled debugging on our dev box and here’s the output:

    01:17:56 /mba/ supercache dir: /vol/www/dp.www.beatthegmat.com/blog/source/wp-content/cache/supercache/dp.www.beatthegmat.com/mba/
    01:17:56 /mba/ No wp-cache file exists. Must generate a new one.
    01:17:56 /mba/ In WP Cache Phase 2
    01:17:56 /mba/ Setting up WordPress actions
    01:17:56 /mba/ Created output buffer
    01:17:56 /mba/ supercache dir: /vol/www/dp.www.beatthegmat.com/blog/source/wp-content/cache/supercache/dp.www.beatthegmat.com/mba/
    01:17:57 /mba/ Output buffer callback
    01:17:57 /mba/ supercache dir: /vol/www/dp.www.beatthegmat.com/blog/source/wp-content/cache/supercache/dp.www.beatthegmat.com/mba/
    01:17:57 /mba/ Anonymous user detected. Only creating Supercache file.
    01:17:57 /mba/ supercache dir: /vol/www/dp.www.beatthegmat.com/blog/source/wp-content/cache/supercache/dp.www.beatthegmat.com/mba/
    01:17:57 /mba/ Gzipping buffer.
    01:17:57 /mba/ Writing non-gzipped buffer to supercache file.
    01:17:57 /mba/ Writing gzipped buffer to supercache file.
    01:17:57 /mba/ Warning! Not writing another page to front page cache.

    It looks like the error message is “Warning! Not writing another page to front page cache.” Can you please let me know what I can do to fix that? FYI, this is happening every time that our home page is loaded.

    Plugin Author Donncha O Caoimh
    Member

    @donncha

    OK, so WordPress is installed in /blog/ but it’s served from /, so why is “/mba/” showing as the url in the error log? That check is there to stop other pages being written to the cached file for the front page.

    Hi Donncha,

    Sorry about the confusing directory structure. Here’s how our site works.

    1. The WP source code for the blog is in the directory /vol/www/HOSTNAME/blog/source/ (we have several different hosts – one for production, a couple for development and one for staging).

    2. The source code for our main website is in the directory /vol/www/HOSTNAME/forum/source. Apache has a virtual host that routes all requests for the site HOSTNAME into the /vol/www/HOSTNAME/forum/source directory.

    3. The code for our main website (/vol/www/HOSTNAME/forum/source) has a symbolic link called “mba” that points to the blog source code directory (/vol/www/HOSTNAME/blog/source)

    We separated the blog source code from our other source code so that we could maintain them separately.

    Please let me know if you need any more info. Thanks so much for your help!

    Plugin Author Donncha O Caoimh
    Member

    @donncha

    So where does WP Super Cache write it’s cache files? Where is the wp-content/ directory? In blog/source/ ?

    Hi Donncha,

    Here is the directory structure for our app:


    /vol
        /www
            /HOSTNAME
            /blog
                /caches - this directory stores the files created by several different caches
                    /wp-cache - this directory stores all files created by the WP cache
                /source - this directory contains the WP source code
                    /wp-content
                        /cache - this is a symbolic link to /vol/www/HOSTNAME/blog/caches/wp-cache

    We use a symbolic link for the WP cache directory because we don’t want to commit/export cache files from our subversion source code repository.

    Please let me know if you need any more info. Thanks!

    Hi Donncha,

    I was wondering if the additional info I gave you is helpful in figuring out what is causing the homepage to not cache? Thanks again for your awesome help!

    David

    Plugin Author Donncha O Caoimh
    Member

    @donncha

    Unfortunately I haven’t been able to look at it, but look for the warning message in wp-cache-phase2.php and remove the if() check that triggers it if you want to fix it straight away.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WP Super Cache isn't caching archive pages correctly’ is closed to new replies.