My cache won't expire. This is effectively my code:

    $template = (isset($params['template']) ? $params['template'].'?'.$config['pageParam'].'='.$pageParam : null);

        echo craft()->cache->get($template);

        craft()->cache->set($template, $JsonValue, 'P1D');

The cache saves just fine but when I forward the clock on my server a few days ahead and refresh the page it's still using the cached data. I've also tried actually waiting a few days in case it was using another clock but that didn't help either.

Is there something I'm missing? I figure Craft or the Yii Framework will take care of expiring the cache after the one day period set (P1D). I don't see any methods to check the date of the cache or anything where I could manually intervene.

For what it's worth I'm using theolampert's fork of the ElementAPI plugin which adds caching.


Looks like a bug in the plugin.

The 3rd $expire parameter when calling set states:

The number of seconds in which the cached value will expire. 0 means never expire.

But it's passing in the PHP time format notation. I'd suggest contacting the author of the plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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