Forums / Developer / Avoiding caching within a subtree?

Avoiding caching within a subtree?

Author Message

Clemens T

Thursday 07 February 2008 12:06:29 am

Hello all,

I'm having the following issue. When creating new users through PHPcode in a node in the Users tree via an extension the subtree of the node where that user is created in, is never cleared from cache. Right now I have to do this manually, to make sure the latest data is available to the users. Is it possible to do a cache refresh after every user I create in my code, or is it better to avoid caching at all on this subtree? If so: how?

Thanks!!
Clemens

Ɓukasz Serwatka

Friday 08 February 2008 12:55:57 am

Hi,

I assume that you know that subtree ID. then in PHP you can just clear view cache like:

eZContentCache::cleanup( array( $nodeID ) );

Remember include that class.

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

Clemens T

Tuesday 12 February 2008 1:11:23 am

Great stuff!! That's it. Works like a charm :).

eZ debug

Timing: Jan 19 2025 08:48:43
Script start
Timing: Jan 19 2025 08:48:43
Module start 'content'
Timing: Jan 19 2025 08:48:43
Module end 'content'
Timing: Jan 19 2025 08:48:43
Script end

Main resources:

Total runtime0.0187 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.9766180.8281
Module start 'content' 0.00570.0058 769.804794.0078
Module end 'content' 0.01150.0071 863.812570.7031
Script end 0.0186  934.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002111.4102120.0002
Check MTime0.00105.3791120.0001
Mysql Total
Database connection0.00084.396110.0008
Mysqli_queries0.002513.570640.0006
Looping result0.00000.074120.0000
Template Total0.006836.310.0068
Template load0.00074.010110.0007
Template processing0.006032.249310.0060
Override
Cache load0.00052.825110.0005
General
dbfile0.003317.5909100.0003
String conversion0.00000.026830.0000
Note: percentages do not add up to 100% because some accumulators overlap

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.0002 secs