Support » Plugin: WP-Optimize - Cache, Clean, Compress. » Setting different cache lifespan for different pages?

  • Resolved quyle

    (@quyle)


    Hi there,
    First, I’d like to thank you for create awesome plugin… I really love it!!!
    I have 3 questions that would like to ask:
    1/ I’d like to know if if your plugin has option to set different Cache lifespan for different pages? eg. home page’s cache lifespan is 1 day, posts page is 30 days…
    Am I able to achieve that?

    2/ when I “view source” (F12), it said “<!– Cached by WP-Optimize (gzip) – https://getwpo.com – Last modified: Sun, 26 Apr 2020 08:42:52 GMT –>
    “, but in dev tool’s network tab, response header said that “Cache-Control: no-cache”? Also, it mentioned “Cache-Control: max-age=2592000” even though I only set cache lifespan of 24 hours?
    Would you mind making this clear to me?

    3/ finally how can I change the timezone of cache? I’ve set my timezone in Setting of wordpress but it does not work with your plugin

    Thank you very much and best regards,
    Q.

    • This topic was modified 1 year, 6 months ago by quyle.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Marc Lacroix

    (@marcusig)

    Hi there,

    Glad you’re enjoying the plugin 🙂

    1/ You cannot specify different cache lifespan per page. But you could achieve something similar by adding custom actions (coding required).
    For example if you want your front page to contain the latest blog posts, you could add an action that deletes the front page cache when a post is saved.

    2/ The cache lifespan as set in WP-Optimize does not influence the Cache-Control setting: The cache lifespan affects the time at which the saved cache is renewed on the server, while the cache-control header is an indication for the browser.

    The html document is served with Cache-Control: no-cache, which means that the browser needs to check with the server if there’s a new version of the page. If the server responds with 304 Not Modified, the version stored in the browser will be served.
    The Cache-Control: max-age=2592000 is likely to be from an asset (like an image), which is configured in the “Static file headers” tab.

    3/ You can’t currently change this.

    Thread Starter quyle

    (@quyle)

    Thanks for your kind and detailed reply! 😀
    One thing I am a bit unclear is I’ve Browser static file caching headers enabled. But Why are only 50% of my static resources,eg. images, css, js served from browser cache?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Setting different cache lifespan for different pages?’ is closed to new replies.