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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 11:37:56
Script start
Timing: Jan 19 2025 11:37:56
Module start 'layout'
Timing: Jan 19 2025 11:37:56
Module start 'content'
Timing: Jan 19 2025 11:37:57
Module end 'content'
Timing: Jan 19 2025 11:37:57
Script end

Main resources:

Total runtime1.2605 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.1484152.6250
Module start 'layout' 0.00650.0028 741.773439.4453
Module start 'content' 0.00931.2496 781.2188638.5313
Module end 'content' 1.25900.0016 1,419.750020.1641
Script end 1.2605  1,439.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2899160.0002
Check MTime0.00140.1138160.0001
Mysql Total
Database connection0.00100.076710.0010
Mysqli_queries1.174193.1425710.0165
Looping result0.00090.0729690.0000
Template Total1.227297.420.6136
Template load0.00200.157120.0010
Template processing1.225297.193720.6126
Template load and register function0.00030.021310.0003
states
state_id_array0.00140.108710.0014
state_identifier_array0.00130.105820.0007
Override
Cache load0.00210.1664660.0000
Sytem overhead
Fetch class attribute can translate value0.00230.183930.0008
Fetch class attribute name0.00140.114290.0002
XML
Image XML parsing0.00160.127730.0005
class_abstraction
Instantiating content class attribute0.00000.0021110.0000
General
dbfile0.00160.1280250.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 37
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs