开发者

All cached but a partial in Symfony

开发者 https://www.devze.com 2023-03-27 00:01 出处:网络
I have a template within my project wich is cached with a partial call inside: <h1>My template</h1>

I have a template within my project wich is cached with a partial call inside:

<h1>My template</h1>
<?php include_partial('my_partial)?>

I don't want to cache the partial because it depends on the user. Is this possible?

I tried to disalbe the partial's cache without success:

//myModule/config/cache.yml
action:
  enbabled: true
_my_partial:
  enabled: false

The other solution that should work is to call the partial with an user dependant sf_cache_key:

<h1>My template</h1>
<?ph开发者_开发问答p include_partial('my_partial',array('sf_cache_key'=>$id_user)) ?>

But with a lot of users it will overload the cache because each user will have it's own version stored.

Any ideas?

Thanks in advance


Maybe the reason is inside cache: enabled key-value pairs ? I believe, the proper config should be:

//myModule/config/cache.yml
action:
  enabled:    true
_my_partial:
  enabled:    false

all:
  enabled:     false
  with_layout: false   # Default value
  lifetime:    86400   # Default value

Hope this will be useful.


You need this in your cache.yml

_my_partial:
  enabled:    on
list:
  enabled:    on
...

it's enabled: on and not cache: enabled.

0

精彩评论

暂无评论...
验证码 换一张
取 消