Forums / General / Custom Tag Caching Problems

Custom Tag Caching Problems

Author Message

John Smith

Friday 19 January 2007 10:15:27 am

Hi there,

Hope someone can help. I have created a custom tag but facing some problem with caching.

In a folder, I have created an article with the custom tag in it. The main function of the custom tag is to fetch latest five articles from some node id. But when I create a new article in the specific node from where the custom tag is getting the data is not fetching the new article.

Everytime to get the result I have to manually clear the cache.

Please help...

Smith

Paul Borgermans

Friday 19 January 2007 4:16:05 pm

Hi John,

This is "by design" with using the content view caches and a bit hard to avoid. However, can't you have the same functionality without the custom tag?

For example, another scenario is that the article has dedicated attribute replacing the custom tag, possibly with the parent node id from which you want to fetch the latest 5 new items. In that case, you could make the article template so that it first turns off caching but for the "main" part it uses a normal cache block and for the part with the latest 5 articles no cache block.If there is no nodeid in the new article attribute, you just do not do a fetch.

Hth

Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

John Smith

Saturday 20 January 2007 1:59:07 am

Hi Paul,

Thanks for you kind help.

Will the same thing as explained by you applies to folder class as well. Need to fetch articles from two/three nodes there.

For eg.

Folder A
|-> Subfolder B (10 articles)
|-> Subfolder C (20 articles)
|-> Subfolder D (15 articles)

In folder A, I want to fetch 5 articles from each of the subfolders. This means when I click folder A from the menu, it should display three boxes having 5 articles from each of the subfolders.

Thats why I have created custom with node id as parameter to be passed while inserting the custom tag. In this way I can use that custom tag anywhere where I want to fetch latest five articles.

My problem is when I insert any new article in subfolder B, C, D, the listing on the page A does not get updated.

Is my problem a bug or I am looking for something impossible.

Please help.....

Cheers
Smith

kracker (the)

Saturday 20 January 2007 3:26:16 am

Well, you did do a great job giving further information about what your exactly trying to do.

The main problem is ... you need to stop using that custom tag, it is <b>not</b> going to meet your needs.

After you let go that the custom tag is not the 'best' solution, <i>then</i> we can move forward.

I would recommend creating a custom template which would contain the fetch and display your lists of content. You may also read up on the use of cache blocks, <i>http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/cache_block</i>

<i>hth,
//kracker

tv : squidbillies</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

John Smith

Saturday 20 January 2007 7:09:47 am

Hi,

Would it be possible for you to guide me bit more in details.

Cheers
Smith

kracker (the)

Saturday 20 January 2007 7:23:57 am

Ask a specific question ...

Read up, try to create a toolbar item as an example exercise ...

<i>http://ez.no/ezpublish/documentation/customization/components/toolbars/adding_new_tools_to_toolbar_list
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/visualization/tool_bar
http://ez.no/content/advancedsearch?SearchText=toolbar&SearchContentClassID=9&SearchPageLimit=5</i>

If you can write a custom tag you should (with some work) be able to integrate your code into a template to include in your pagelayout.tpl whether with a simple 'include' of another template with the code or using a toolbar.

//kracker

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Paul Borgermans

Saturday 20 January 2007 9:08:31 am

Here you go :-)

In the template for your article, put the following at the top:

{set-block scope=root variable=cache_ttl}0{/set-block}

Surround your article content with

{cache-block}
{*your article content*}
{/cache-block}

and use the following where you fetch the latest articles:

{cache-block subtree_expiry='mynews/folderx''}
{*fetch ....*}
{/cache-block}

hth
Paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

eZ debug

Timing: Jan 19 2025 09:11:58
Script start
Timing: Jan 19 2025 09:11:58
Module start 'content'
Timing: Jan 19 2025 09:11:59
Module end 'content'
Timing: Jan 19 2025 09:11:59
Script end

Main resources:

Total runtime1.4253 sec
Peak memory usage4,096.0000 KB
Database Queries208

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0092 588.9453180.8438
Module start 'content' 0.00921.1315 769.7891643.6094
Module end 'content' 1.14070.2845 1,413.3984341.0703
Script end 1.4252  1,754.4688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00490.3468210.0002
Check MTime0.00180.1264210.0001
Mysql Total
Database connection0.00080.058810.0008
Mysqli_queries1.303291.42992080.0063
Looping result0.00330.23342060.0000
Template Total1.385097.220.6925
Template load0.00300.210320.0015
Template processing1.382096.959320.6910
Template load and register function0.00060.038610.0006
states
state_id_array0.00300.210110.0030
state_identifier_array0.00120.085920.0006
Override
Cache load0.00270.1864660.0000
Sytem overhead
Fetch class attribute can translate value0.00200.137040.0005
Fetch class attribute name0.00130.087890.0001
XML
Image XML parsing0.00190.133940.0005
class_abstraction
Instantiating content class attribute0.00000.0018110.0000
General
dbfile0.01471.0321360.0004
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 37
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs