Title: Refresh cache for single page
Last modified: March 12, 2019

---

# Refresh cache for single page

 *  Resolved [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/)
 * Is there any way for a PHP script in my theme to force a single page to be refreshed
   in the cache?
 * We have a page for an events calendar which uses a PHP script to show current
   and future events in our area. To ensure that events in the past are not displayed
   we clear the cache for that page every night from a cron job using
 * `$GLOBALS['wp_fastest_cache']->singleDeleteCache(false,$post_id)`
 * This works OK but performance issues on our server can result in the first request
   for this page each day being very slow so I’d like to be able to arrange for 
   our cron job to force the page to be cached immediately after clearing it.
    -  This topic was modified 7 years, 7 months ago by [Mike Clarke](https://wordpress.org/support/users/rawthey/).

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11303851)
 * I recommend you to enable “Restart After Completed” option of preload feature.
   Thus you don’t have to clear cache every night.
 * [https://www.wpfastestcache.com/features/restart-preload-after-completed/](https://www.wpfastestcache.com/features/restart-preload-after-completed/)
 * And you need to use the preload manually as below to get the best performance
   for preload feature.
 * [https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/](https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/)
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11304495)
 * Thank you for the suggestions.
 * I was under the impression that selecting the “Restart After Completed” option
   would result in the preload process running continuously after all the cache 
   files are created. Is that correct? Most of our pages don’t change very often
   and we already have “Clear cache of post / page” selected for the “Update Post”
   option so continually preloading everything is a bit of an overkill.
 * The idea of using wget -O – “[http://www.YOUR-URL.com/?action=wpfastestcache&type=preload&#8221](http://www.YOUR-URL.com/?action=wpfastestcache&type=preload&#8221);
   >/dev/null 2>&1 in a cron job as suggested in your second link could be a possibility
   but am I correct in thinking that this can only be used to preload the entire
   site and not individual pages? However it looks like I could just use wget to
   fetch my page after deleting it from the cache and this would result in it being
   cached again.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11305327)
 * > I was under the impression that selecting the “Restart After Completed” option
   > would result in the preload process running continuously after all the cache
   > files are created. Is that correct?
 * yes.
 * > Most of our pages don’t change very often and we already have “Clear cache 
   > of post / page” selected for the “Update Post” option so continually preloading
   > everything is a bit of an overkill.
 * you don’t need to enable either “update post” nor “new post” options if you enable“
   restart” option of preload.
 * > The idea of using wget -O – “http://www.YOUR-URL.com/?action=wpfastestcache&
   > type=preload” >/dev/null 2>&1 in a cron job as suggested in your second link
   > could be a possibility but am I correct in thinking that this can only be used
   > to preload the entire site and not individual pages?
 * yes, entire site.
 * > However it looks like I could just use wget to fetch my page after deleting
   > it from the cache and this would result in it being cached again.
 * I wanted to show you a method. You don’t need to clear any single page with this
   method.
 *  [Frank](https://wordpress.org/support/users/t-mug/)
 * (@t-mug)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11315446)
 * Hi, it’s a bit counter intuitive for me as well. I struggle with the same thing.
   What’s the sense of beeing able to periodically deleting a certain page if afterwards
   the enabled preload would apply to the whole site anyway?
 * So it seems that preloading is always meant as renewing **all** cached files 
   and is not meant to cooperate with the feature of periodic deletion of certain
   pages. So you **cannot** selectively preload, am I right?
 * The counter intuitive part for me is that “selecting” all pages for deletion 
   after a certain amount of time will cause the preload process to start. But if
   you “select” a page (which is kind of the same context for me), then nothing 
   happens, because it’s waiting for the next unfortunate visitor … 🙂
 * Thanks anyway! Do I interpret things properly, so far?
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11340571)
 * Emre Vona wrote:
 * > I recommend you to enable “Restart After Completed” option of preload feature.
   > Thus you don’t have to clear cache every night.
 * I’ve tried out this option and it’s made an improvement to the way things work
   but there’s some issues I’m still a bit uncertain about.
 * We currently have 578 items cached. With the preload option set to process 6 
   pages per minute that should take about 8 hours to refresh the entire cache with
   the wp_fastest_cache_Preload cron task firing every 5 minutes. So there’s a chance
   that our events page could still be showing the previous day’s version even if
   I delete it from the cache in the middle of the night. However I’ve been monitoring
   the cache contents for a few days and it looks like the events page gets refreshed
   in the cache within a couple of hours of my daily cron task which deletes it 
   from the cache. Does the preload system give priority to pages which are not 
   cached or have I just been lucky?
 * Despite my estimate of 8 hours to refresh the entire cache I see some files in
   the cache which are several days old. I think this is a side effect of the way
   that we deal with old events. In order to avoid getting ‘404’ errors when people
   follow search engine results pointing to events which happened in the past we
   don’t delete these from the system, instead the page issues a 301 redirect to
   a page which informs the visitor that the event took place in the past and where
   possible we provide links to similar events which might be of interest. It appears
   that when the preload feature follows the redirect it leaves the cached copy 
   of the original page in place instead of deleting it. Would it be possible for
   WP Fastest Cache to remove an item from the cache if it detects that the item
   is not available or results in a redirection? I appreciate that my pages affected
   by this are very much a special case and can workaround the problem if this isn’t
   possible.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11341520)
 * did you add cron-job as below?
    [https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/](https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/)
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11399087)
 * > did you add cron-job as below?
   >  [https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/](https://www.wpfastestcache.com/features/manually-preload-with-cron-jobs/)
 * No, I appreciate that I’d get more control over the timing instead of relying
   on the WoedPress scheduler but I’ve been running for a while now with the ‘restart’
   option set and things seem to be running OK with updates at a fairly regular 
   5 minute interval. Using cron I could run it more frequently but don’t want to
   put too much load on the system.
 * There’s still a few oddities with some existing unchanged cached pages being 
   refreshed while there were still uncached pages to be processed. Also a small
   number of pages stay in the cache for up to three days before being refreshed,
   But overall the cache appears to be doing what I need so I’ll leave things as
   they are.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11399743)
 * maybe browser caching causes this issue. Did you try via [https://www.browserling.com/](https://www.browserling.com/)
   before?
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11416491)
 * > maybe browser caching causes this issue
 * No, my observations were based on the timestamps on the files in the cache directory.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11418925)
 * did you check the timestamp via [https://www.browserling.com/](https://www.browserling.com/)?
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11420578)
 * > did you check the timestamp via [https://www.browserling.com/](https://www.browserling.com/)?
 * No I logged into the server via ssh and ran
    `find public_html/wp-content/cache/
   all -type f -ls | sort -k 9 | less` to get file details sorted in date order
    -  This reply was modified 7 years, 6 months ago by [Mike Clarke](https://wordpress.org/support/users/rawthey/).
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11422926)
 * can you tell me a sample url please?
 *  Thread Starter [Mike Clarke](https://wordpress.org/support/users/rawthey/)
 * (@rawthey)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11437947)
 * > can you tell me a sample url please?
 * The site is [https://www.sedbergh.org.uk](https://www.sedbergh.org.uk)
 * There’s currently 591 pages in the cache and the preload with restart after completion
   option is selected. With 6 pages every 5 minutes the entire site should be cached
   in about 8 hours. We do however have a number of pages for events which occurred
   in the past (e.g. [https://www.sedbergh.org.uk/view-event/history-society-the-yards-of-kendal/](https://www.sedbergh.org.uk/view-event/history-society-the-yards-of-kendal/))
   and these redirect to a page offering suggestions for alternatives, this page
   is not cached. These extra ‘dead’ events result in more than 591 pages being 
   checked but I’d still expect the entire cache to be refreshed within one day 
   but we currently have pages in the cache from 2 days ago. Here’s the first few
   lines from a directory list of all cached pages sorted in increasing date order(
   with user and group ID obfuscated)
 *     ```
       248031481   39 -rw-r--r--   1 ######### #####       38851 Apr 15 12:52 public_html/wp-content/cache/all/activities/things-to-do-around-sedbergh/a-walk-to-akay-woods/index.html
       817646536   32 -rw-r--r--   1 ######### #####       31507 Apr 15 13:16 public_html/wp-content/cache/all/community/index.html
       1085025119   28 -rw-r--r--   1 ######### #####       27890 Apr 15 19:50 public_html/wp-content/cache/all/view-event/amenities-committee/index.html
       1068103848   35 -rw-r--r--   1 ######### #####       35030 Apr 15 20:06 public_html/wp-content/cache/all/search/map/page/2/index.html
       1081113542   30 -rw-r--r--   1 ######### #####       29211 Apr 15 20:09 public_html/wp-content/cache/all/search/admin/index.html
       1081114494   34 -rw-r--r--   1 ######### #####       34051 Apr 15 20:10 public_html/wp-content/cache/all/search/map/index.html
       294330742   28 -rw-r--r--   1 ######### #####       28149 Apr 15 20:10 public_html/wp-content/cache/all/search/map/page/3/index.html
       294331226   31 -rw-r--r--   1 ######### #####       30366 Apr 15 20:10 public_html/wp-content/cache/all/search/parking\ permit/index.html
       1126852735   35 -rw-r--r--   1 ######### #####       34680 Apr 16 00:36 public_html/wp-content/cache/all/accommodation-detail/russell-cottage/index.html
       1087493208   30 -rw-r--r--   1 ######### #####       29352 Apr 16 01:01 public_html/wp-content/cache/all/locations/barry-mckay-appleby/index.html
       1087494129   30 -rw-r--r--   1 ######### #####       30084 Apr 16 01:01 public_html/wp-content/cache/all/locations/daisyroots-books-grange-sands/index.html
       1087492667   29 -rw-r--r--   1 ######### #####       28851 Apr 16 01:01 public_html/wp-content/cache/all/locations/pages-books-settle/index.html
       ```
   
 * And the most recent entries from the end of the list:
 *     ```
       505814688   29 -rw-r--r--   1 ######### #####       28756 Apr 17 09:45 public_html/wp-content/cache/all/banners/lakes-panorama/index.html
       1271696260   29 -rw-r--r--   1 ######### #####       28661 Apr 17 09:46 public_html/wp-content/cache/all/banners/castle-hill/index.html
       1271696991   29 -rw-r--r--   1 ######### #####       28998 Apr 17 09:46 public_html/wp-content/cache/all/locations/dales-countryside-museum-hawes/index.html
       1316094697   35 -rw-r--r--   1 ######### #####       34340 Apr 17 09:56 public_html/wp-content/cache/all/view-event/sedbergh-artisan-market-18/index.html
       1316092262   33 -rw-r--r--   1 ######### #####       32753 Apr 17 09:56 public_html/wp-content/cache/all/view-event/sedbergh-artisan-market-19/index.html
       1316095845   35 -rw-r--r--   1 ######### #####       34997 Apr 17 09:57 public_html/wp-content/cache/all/view-event/sedbergh-artisan-market-16/index.html
       1316095536   35 -rw-r--r--   1 ######### #####       34583 Apr 17 09:57 public_html/wp-content/cache/all/view-event/sedbergh-artisan-market-17/index.html
       1307866353   35 -rw-r--r--   1 ######### #####       35058 Apr 17 10:00 public_html/wp-content/cache/all/view-event/sedbergh-artisan-market-15/index.html
       1307867714   30 -rw-r--r--   1 ######### #####       29772 Apr 17 10:01 public_html/wp-content/cache/all/view-event/antiques-fair/index.html
       1314524776   31 -rw-r--r--   1 ######### #####       30462 Apr 17 10:17 public_html/wp-content/cache/all/view-event/farfield-mill-free-entry-to-locals/index.html
       1292158275   30 -rw-r--r--   1 ######### #####       29188 Apr 17 10:18 public_html/wp-content/cache/all/view-event/fish-chips-in-dent/index.html
       994960231  259 -rw-r--r--   1 ######### #####      136267 Apr 17 10:26 public_html/wp-content/cache/all/community/parish-council/meetings/index.html
       ```
   
    -  This reply was modified 7 years, 6 months ago by [Mike Clarke](https://wordpress.org/support/users/rawthey/).
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11440417)
 * do you mean that the preload works slowly?

Viewing 14 replies - 1 through 14 (of 14 total)

 The topic ‘Refresh cache for single page’ is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 14 replies
 * 3 participants
 * Last reply from: [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/refresh-cache-for-single-page/#post-11440417)
 * Status: resolved