Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SS_CACHE Invalidating and lifetime


Go to End


2 Posts   1614 Views

Avatar
doublecheese

Community Member, 5 Posts

21 July 2016 at 4:01pm

Hi,

I have 2 questions:

1) I read this in the docs and just wanted to clarify something please:
"You can also specifically clean a cache. Keep in mind that Zend_Cache::CLEANING_MODE_ALL deletes all cache entries across all caches, not just for the 'foo' cache in the example below.
$cache = SS_Cache::factory('foo');
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
"

Does that mean if I have a cache named "foo" and "bar", using Zend_Cache::CLEANING_MODE_ALL will remove all cache entries on both of those caches? How to I delete only the cache entry for "foo"?

2) On the lifetime, I've set my cache to only live for 2 minuted but I noticed the cached entries are not invalidated automatically. Again, the documentation is not very clear and it says:

"Normally there's no need to remove things from the cache - the cache backends clear out entries based on age and maximum allocated storage. If you include the version of the object in the cache key, even object changes don't need any invalidation. You can force disable the cache though, e.g. in development mode."

So, how do I add the "If you include the version of the object in the cache key" is there an example of this?

Avatar
Nicolaas

Forum Moderator, 224 Posts

10 December 2016 at 10:10pm