Caching in silverstripe



notes for Caching in silverstripe:

create cache folder

create silverstripe-cache folder in silverstripe root then run /?flush=all

caching objects

<% cached 'superduperfunction', LastEdited %> <% end_cached %> (bei dieser variante gibt es einen refresh, sobald auf speichern geklickt wird) oder (aber hier gibts kein refresh, ohne speichern!) <% cached %> <% end_cached %>

set time out for cache

in _config.php

// set expiration to one hour SS_Cache::set_cache_lifetime($for = 'any', $lifetime = 3600, $priority = 100);

cache if user is logged in

<!-- don't cache if the current user is logged-in --> <% cached unless CurrentUser %> <!-- cache only if the current user is logged-in --> <% cached if CurrentUser %>

clear cache as admin

testpage/?flush=all

src

https://github.com/tractorcow/silverstripe-dynamiccache nice explanations with set time: http://www.balbuss.com/partial-caching/



Tags:
Published: December, 2014