This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Use some cache in a custom fetch...
expandshrink

Use some cache in a custom fetch function

Use some cache in a custom fetch function

Thursday 01 April 2010 7:08:57 pm - 2 replies

Hi,

 

I've done a function fetch in my extension, It may be called several times in a page, and I now the result is always the same, how can I make my fetch use a cache ?

 

I could use $GLOBALS of course and store in a specific key (hoping not to override an existing key), but I'm sure there's a better way happy.gif Emoticon

Any idea is welcome

Thursday 01 April 2010 9:06:11 pm

Well, honestly, if you just need to cache temporary data for one run, you should use a global... just centralize the read/write code for these globals so that you can easily refactor it, and prefix your global names with your initials or company acronym... just like we do with eZ. There should be no conflicts this way (not more than with classes, at least :p).

If you want to implement more persistent caching, here are the options I would consider:

  • ezcCache. That's it :p
    We plan on re-implementing most caches using the Cache component from the ezComponents. It has support for hierarchical cache, and already supports standard backends (memcache, APC, files...).
    http://ezcomponents.org/docs/tutorials/Cache

Thursday 01 April 2010 9:34:28 pm

Ok thanks

I already use it for plain file cache, I've seen memory cache also, let's test that...

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from