I'm trying to clear cache with ce_cache:clear and conditionals but it seems if ce_cache:clear always gets called for. Conditionals are based on cache date and edit date. So when cache date minus edit date is less then 0 clear cache and rebuild it.

I've tried many different ways but without any luck. Things as preload vars, stash set, parse inward etc have been tried but I'm problably overseeing something.

{exp:ce_cache:get_metadata id="page"}
    {exp:stash:set name="cache_date_raw"}{made}{/exp:stash:set}

{exp:channel:entries channel='channel'}
    {if '{exp:stash:get name="cache_date_raw"}' < '{edit_date format="%U"}' }
            {exp:ce_cache:clear tags="{url_title}" refresh="5"}

Or perhaps I'nm not using ce-cache the right way. I've used the break settings in the CP but things get cleared too often. This is due to the fact members are working in draft modus.

Cheers, Martijn

1 Answer 1


From memory, the cache clear function always gets called irrespective of conditionals. My only thought is you could call via Ajax or snippet inside the conditional so it is only called/loaded once the conditional has been evaluated.

  • it seems that way. I'm trying one more setup where the cache meta data and the cache:it are both called within the entry loop. No idea what that does with the performance but worth the try.
    – Sharkbyte
    Commented Oct 16, 2017 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.