cancel
Showing results for 
Search instead for 
Did you mean: 

Saving things into Magento's cache with $cache->save... not being flushed from cache after time set?

Saving things into Magento's cache with $cache->save... not being flushed from cache after time set?

Hi there,

 

I'm wondering if anyone can help me. I've recently started saving things into Magento's cache, with the method of...:

 

$cache->load($catnameCacheKey)

cache->save($catname, $catnameCacheKey, array("prod_info_vars_cache"), 86400);

(obviously missing some code in there)

 

I can only view changes when I flush the Cache Storage for this (not flushing Magento's general cache). However, it doesn't appear to be getting flushed out after 86400 seconds? So we had stale content over the weekend. I would expect it to be flushed every day (86400 seconds).

 

Forgive me for sounding incredibly noobish. Can I set a cache flush on a cron job if Magento won't do this as standard? What's the best way of doing this?

2 REPLIES

Re: Saving things into Magento's cache with $cache->save... not being flushed from cache after ti

What caching backend are you using? I think memcache was not checking or validating the cache on load. But check your cache implementation.

A work around could be creating a unique ID for specific time by using the date(‘’) function or floor(time() / seconds)

could also clear via cron the whole cache or only for certain tags (also not supported by memcache)

Re: Saving things into Magento's cache with $cache->save... not being flushed from cache after ti

Hi there.

 

Thank you for your reply. Yes, I've since discovered that it is being saved in Memcache, because when I flush all of Magento's files etc and refresh its cache it's all staying in Memcache.

 

So would I need to do some sort of codechange for it to work with Memcache? I would ideally want my coded cache to flush when I "refresh Magento's cache", I don't want to keep wiping out memcache every time I need to update content..! We are moving to use redis soon. I hope it will work better. But for now did you think there's something I can do to get it to expire from memcache?

 

Thanks again for your reply!