Elliot Haughin

I'm a freelance web developer.
I build clever, engaging, ass-kicking,
web applications. You want me?

email me, tweet me, skype me

Wanted to use Memcache with your codeigniter application? – Or how about Alternative PHP Cache?
Well, now multicache helps you do that, with 1 library file to make a cache abstraction layer, you can use a variety of caching methods for your application.

Download Multicache Here

How to use:
Just extract the Multicache.php to application/libraries/Multicache.php and then configure your cache setup in the:

function Multicache() {

area of the library.

Once you’re done, it’s ready to use in your controller, like so:

$this->load->library('multicache');		
if ( !$this->multicache->get('keyhere') )
{
	$this->multicache->set('keyhere', 'nice long string here');
}

Enjoy!

Sponsored Links

Comments

  1. [...] But for now, check out CodeIgniter Multicache [...]

  2. [...] CodeIgniter Multicache Library at Elliot Haughin Excellent. Memcached module for Code Igniter. (tags: CodeIgniter modules code memcached database) [...]

  3. willwin says:

    Hey! Nice work but for me it’s one thing missing and I can’t use your class because of it. I’m talking about grouping cache items to reset them by group name. For example, i have lots of pages in some catalog and sometime I need to make some change and clear cached catalog pages. Unfortenately, php_memcached don’t have such functionality “from the box” :-(

  4. Victor says:

    Are the memcache servers referring to the webserver? I thought memcache was just a library, or does it need to be configured to work on a particular port?

    Also can the data stored be objects? i.e., not just plain strings.

  5. Elliot says:

    Hey Victor,

    Memcache is actually a daemon which can run on a separate server and recieve requests via TCP.

    However, the Memcache daemon can be running on the same machine as the webserver (localhost).

    The Memcache PHP extension simply allows PHP to communicate with a memcache service.

    Data can be stored as objects, arrays, strings, integers… pretty much anything!

  6. Victor says:

    Ah ok. Cool!
    Thanks for writing this CI library.

  7. Victor says:

    Hi Elliot,
    I’m not sure whether this has been brought up, but in your _connect_memcache() method you’ve got
    if ( !empty($this->config['servers']) )
    when it should be
    if ( !empty($this->config['memcache_servers']) )

    Cheers
    Victor

Leave a Comment

© Copyright 2009 Elliot Haughin