I’ve got some caching code in my plugin but it’s just not storing it. It’s adding the value to $this->EE->session->cache but the values is gone next time I hit the page. I’ve set my cache path to the right place but still no luck. I’m using WAMP 2.2 which might be the problem. Any ideas?
Config.php
$config['cache_path'] = 'C:/wamp/www/ee240/system/expressionengine/cache/';My plugin:
if ($this->EE->session->cache('testcache', 'item')) {
echo $this->EE->session->cache('testcache', 'item');
} else {
$this->EE->session->set_cache('testcache', 'item','foo');
}Ah I see, I misunderstood what Session cache did. I’m using $_SESSION instead which seems to do the job. However it would be ideal if there was something in EE that could globally cache some arrays for all users. Have you come across anything that can do this?
I’ve had a look at the Cache driver in CodeIgnitor here http://ellislab.com/codeigniter/user-guide/libraries/caching.html but I’m not sure how to get it working with my plugin as I don’t see how I can load CI drivers from an EE plugin.
I was going to post exactly the same question!
Checking through libraries/Session.php is does say:
Set Session Cache * * This method is a setter for the $cache class variable. * Note, this is not persistent across requests
So I’ve got the same question. How do you store persistant data across requests using an EE API?
Thanks.
What’s the performance hit on that? If for instance every page request was checking persistent data, is a cookie a good idea?
In my case session vars was a good way to go as it’s per user specific. I needed to show random data on each page but make it less random! So I’m keeping a log of the last 10 entries and only showing a ‘random’ not seen recently entry.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.