CodeIgniter 2 Memcache Driver February 1st, 2011
So What’s With the “D”?
This StackOverflow page covers it pretty well. Memcached is better, however it is named quite poorly. It is also quite new, and thus not supported as broadly as the Memcache module.
Memcached is to Memcache as MySQLi is to MySQL
CodeIgniter 2 Only Loves Memcached?
Yes, it seems CodeIgniter 2 only has love for Memcached. However, do not fear — I was able to harness the power of search and replace to come up with a CodeIgniter 2 Memcache driver.
Where Can I Get This Masterpiece of Code?
This driver may be downloaded on Github.
How Do I Use It?
Copy the driver into
After you have done that, add “memcache” to the “valid_drivers” array in
Next, in your controller, you can place some code like this:
$this->load->driver('cache'); $this->cache->memcache->save('var_name', 'var_value', 60); echo $this->cache->memcache->get('var_name');
What’s the Warranty?
I’ll be honest, I really haven’t tested this driver much. It seems to work fine for me on my web host, but there are no guarantees.
blog comments powered by Disqus