[solved] Viewcache issue

Author Message

Tristan Rivoallan

Friday 22 July 2005 2:37:59 am

Hi,

i'm having trouble setting up view cache for a private area of the website i'm currently developping.

If i enable viewcaching, once user A logs in and cache for his views are generated, every other that logs after user A will see user A views. Cache is only created once.

I tried to surround user related parts of content with

{cache-block keys=array($user_uid, $request_uri)}
  Private content
{/cache-block}

this didn't change anything.

I'm using a custom user login handler (don't know if it is of any interest).

any pointers ?

thx in advance

Łukasz Serwatka

Friday 22 July 2005 4:08:02 am

Hi Tristan,

Look at this article
http://ez.no/products/ez_publish_cms/documentation/incoming/how_to_set_cache_expire_time_or_disable_cache_in_template

and

http://ez.no/products/ez_publish_cms/documentation/development/kernel/cache_block_optimization

Makre sure that $user_uid has correct value.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Tristan Rivoallan

Friday 22 July 2005 5:54:43 am

Thanx for answering.
I already read (and read again) these articles.

> Look at this article
> http://ez.no/products/ez_publish_...re_time_or_disable_cache_in_template

If I set cache_ttl to 0, it works but then there's no more caching so that is pretty useless ;)

> http://ez.no/products/ez_publish_...ment/kernel/cache_block_optimization

> Make sure that $user_uid has correct value.

I thought for a long time that this was the problem. But now that I am sure that the value is correct, the problem persists :(
I set this value with

{ezhttp('id_partenaire', 'session')}

. Can this be a problem ?

Using cache blocks looks pretty straightforward as long as you are sure of key uniqueness. I'm now 100% sure that keys are unique, but i'm still having trouble.

I'll continue looking for a solution

Łukasz Serwatka

Friday 22 July 2005 6:36:10 am

Have you tried without cache-blocks?

Try also with this code:

{def $current_user=fetch( 'user', 'current_user' )}

{cache-block keys=$current_user.contentobject_id}
    Private content
{/cache-block}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Konrad Mazurkiewicz

Friday 22 July 2005 7:46:37 am

Hi,
if your cache-block is in class view template only way is to disable cache for whole template.

Look at thread where it is clarified:
http://ez.no/community/forum/developer/viewcaching_and_cache_block_when_to_use

Konrad

Tristan Rivoallan

Monday 25 July 2005 3:04:44 am

WOUHOU! it works.

thanx for the clarification, for me cache-blocks and view cache where the same thing.

so the trick was to disable view caching and enabling cache blocks.

i'm now looking for a way to pregenerate cache after every change of data in the db. See you in another thread...

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 31 2025 06:26:47
Script start
Timing: Jan 31 2025 06:26:47
Module start 'layout'
Timing: Jan 31 2025 06:26:47
Module start 'content'
Timing: Jan 31 2025 06:26:47
Module end 'content'
Timing: Jan 31 2025 06:26:47
Script end

Main resources:

Total runtime0.0127 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.1250151.2109
Module start 'layout' 0.00520.0022 739.335936.6328
Module start 'content' 0.00740.0042 775.968894.2500
Module end 'content' 0.01150.0012 870.218837.9922
Script end 0.0127  908.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002318.2300140.0002
Check MTime0.00118.6236140.0001
Mysql Total
Database connection0.00096.774210.0009
Mysqli_queries0.001814.299130.0006
Looping result0.00000.172210.0000
Template Total0.00097.210.0009
Template load0.00075.503210.0007
Template processing0.00021.679110.0002
Override
Cache load0.00053.706310.0005
General
dbfile0.00032.047880.0000
String conversion0.00000.054340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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