how to : pages and news in cache

vincent3569 Member, Translator
hi

is there a way to store in cache the news (of course not news list, but single news) and pages?
I can't find a way to do that, neither in zenpage nor cachemanager plugins options.

Comments

  • acrylian Administrator, Developer
    Pages/news are like all theme page automatically cached as needed by the static_html_cache plugin if it is enabled. They cannot be pre-cached like images. This is not really needed as images make the most overhead when being generated.
  • vincent3569 Member, Translator
    hi
    thanks malte, I have not seen this plugin before.
    some other questions: how this plugin is supposed to work, for album, image and news page?
    for examples:
    - I add an album, or I add a picture in an album or I add a news
    - I change the publish status or comment status, or I update a news/page content

    in that cases, there is a trigger that allows html_cache refresh or should I exclude some items from html-cache?
  • acrylian Administrator, Developer
    Interesting, that plugin is part of the package since 2009 already and has often been referred to by us ;-)

    More info about the html cache here:
    http://www.zenphoto.org/news/caching#static-html-cache

    Since neither the cace plugin nor the item itself knows where parts of an item may be shown (e.g. front page, sidebar) clearing the whole cache is the only way to really make sure it does not show up unwanted anywhere.

    We probably could clear the cache or add a checkbox to do so whenever you save/edit something but we decided not to so far. But for normal usages that might be unneeded.
  • vincent3569 Member, Translator
    of course, I use cache_manageer plugin to cache pictures, but until now, I never use the html cache.

    I read infos about this plugin, but I don't all understand and maybe, infos should be more accurate.
    by example : what have to be the syntax of excluted files.
    I try to exclude my gallery page and news page, with thi syntax, but it doesn't work (pages are cached):
    `vincentbourganel.fr/news, vincentbourganel.fr/page/gallery`

    other feedback:
    if an object had some custom code in blockcode, this object should not be cached, because you don't know what is effect of php code on html result
  • acrylian Administrator, Developer
    As the doc says the page file name and/or titlelink only:
    `If you want to exclude a page completely enter`page-filename.php/`.
    If you want to exclude a page by a specific title, image filename, or album folder name enter `pagefilename.php/titlelink` or image filename or album folder. Separate several entries by comma.

    So `news.php/,gallery.php/` in your case. (There should have been an example of default excluded pages actually).

    It is not possible to exclude pages because of custom content. That would require to do partly things we actually want to prevent by caching. If the custom code is PHP code the display that happened while caching is preservered. If it is custom JS code (Google Ads, maps) nothing is cached (PHP before dispaly in browser, JS after display in browser - the cache caches before display).
  • vincent3569 Member, Translator
    If the custom code is PHP code the display that happened while caching is preservered

    I don't understand...
    php code may not always generate the same result and html code (ie retruns of a dynamic album), so how can you write that the display is preserved?

    another question:
    is it normal that all album levels are not cached (tested with zenpage theme)?
    ie:
    I have the album structure
    album1 (with subalbum album1/suablbum1 and album1/suablbum2)
    album2
    album3
    album1, album1/suablbum1, album1/suablbum2 are cached, and all other top level albums are not cached.
  • acrylian Administrator, Developer
    php code may not always generate the same result and html code (ie retruns of a dynamic album), so how can you write that the display is preserved?

    The concept of a static html cache (not only this one) is that the server is relieved so that no PHP is excecuted and no MySQL queries are done*. It serves a saved html page instead as long as the cache is not outdated or cleared (or your are loggedin). That speeds up loading. Nothing is faster than a plain html page.

    As said if you change something significant you need to clear the cache obviously.

    All album levels are cached as long as there are no uncached images. That can happen if you have set album thumbs to random instead of a fixed one.

    *Not fully correct as some PHP stuff is of course executed to find out what cached page to get.
  • vincent3569 Member, Translator
    All album levels are cached as long as there are no uncached images. That can happen if you have set album thumbs to random instead of a fixed one.
    sorry, but I don't understand the conditions to cache an album/image page.
    can you explain, more clearly?
  • acrylian Administrator, Developer
    If am image/album page has uncached images (= i.php urls) it is not html cached. As soon as the image is cached (= url /cache/…) the page is cached as html page. Everything that is generated server side is cached. Freezed on the moment if you will. Except Javascript things like a slider since that is generated client side (in the browser). That's all.
  • vincent3569 Member, Translator
    thanks Malte, it seems to be clear.
    what is the behavior in case of random picture for album thumb ?
    the album page is cached only when all possible random pictures have been cached ?
  • acrylian Administrator, Developer
    what is the behavior in case of random picture for album thumb ?
    That was a bit off explained. As soon as the page has cached images incl. album thumbs) it is cached. But if you have a lot random thumbs and all are not already cached, it might take a while until the cache actually can cache the page. So a fixed album thumb is the better way (it is generally for performance regarding image caching anyway).
Sign In or Register to comment.