How can I use memcache to cache something in Helper function |
Now I'm going to create a customized Helper, and in now of its function I want to use memcache to cache something.
So what should I do to use cache like in controller?
Use the Cache library with the Memcached driver.
Since you said you were building a helper, I've used $CI in place of $this. I've also used getData() and $cacheDuration to represent a generic function and variable rather than $this->getData() and $this->cacheDuration (for a generic method and property) to represent how you get the data to be cached and how long it will be cached, respectively. PHP Code: $CI =& get_instance(); (08-28-2015, 07:55 AM)mwhitney Wrote: Use the Cache library with the Memcached driver. That is awesome! Now I understand what is get_instance used for. Thanks a lot! |
Welcome Guest, Not a member yet? Register Sign In |