Forums / Developer / help needed: what do various cache switches affect

help needed: what do various cache switches affect

Author Message

Massimiliano Bariola

Thursday 15 December 2005 3:22:29 am

I have run into a cache-related problem with my website.

I use , as cache switches, templatecache, viewcaching, templatecompile. the site works perfectly when those are off.

on the site I have 3 pages, especially homepage ( see http://www.ioscelgo.it ) which have a buggy behavior when caches are on. the buggy part is a poll part.
if an user hasn't voted, he will see the radiobuttons to vote.

The fact that an user has voted will be recorded on a cookie, and if he is a registered user, also on DB. to do that, I have written an extension to save the cookie and eventually the DB entry, and a custom template operator which checks in cookies and db if he did vote.

the logic goes like this...
{if $current_poll|uservoted} -- uservoted is my own template operator
.... display results ......
{else}
.... display radiobuttons and form; ACTION is /extension/mypollhandler
{/if}

The trouble is, when I turn on caching, this mechanism will no longer work
and every user - also those who haven't voted - will see the results and will be unable to vote. It is as the cache evaluates the fact that an user has voted, and all following page requests from different users will be sered the "already voted" part.
I had a similar problem (which I still have to resolve) when using paginator (the google.tpl) - the first user visiting a page including google.tpl will make it evaluate a certain set of links to pages 1,2,3 ... of object set A, and those links will also be used by paginators of objects sets B , resulting in user going from, say, page 1 of set A to page 2 of set B.

I think this is due to the fact that caching of that part of page is not related to publishing of an object, as it is not an object in itself, but rather an evaluation of many factors which implicitly use node info etc, and then produce an output.

I have tried surrounding the parts with a {cache-block $current_user, $uri_string} as suggested by the docs, but this caused the template output to show both the results AND the radiobuttons.

I am currently running the site with cache disabled, but of course this makes a big hit on the server. Anyone can help? either by spotting an error in my "code" or suggesting how to set up cache configs? I have trouble understanding exactly what viewcaching does (does it still output php? does it output html so there is no more condition evaluated dynamically? etc.)

thank you

eZ debug

Timing: Jan 20 2025 18:10:49
Script start
Timing: Jan 20 2025 18:10:49
Module start 'content'
Timing: Jan 20 2025 18:10:49
Module end 'content'
Timing: Jan 20 2025 18:10:49
Script end

Main resources:

Total runtime0.1993 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0145 587.8594180.8125
Module start 'content' 0.01450.0078 768.671993.9297
Module end 'content' 0.02240.1769 862.6016525.3750
Script end 0.1992  1,387.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00391.9499200.0002
Check MTime0.00150.7431200.0001
Mysql Total
Database connection0.00070.365810.0007
Mysqli_queries0.105953.13651410.0008
Looping result0.00150.74271390.0000
Template Total0.176488.510.1764
Template load0.00090.438110.0009
Template processing0.175688.092610.1756
Override
Cache load0.00060.308110.0006
Sytem overhead
Fetch class attribute can translate value0.00070.330710.0007
XML
Image XML parsing0.00020.109810.0002
General
dbfile0.042021.0983200.0021
String conversion0.00000.004530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs