Very fast file caching library for CodeIgniter

I’ve written a file caching library for CodeIgniter. It’s blazing fast, can cache anything, for any length of time, and supports cache tagging which means you can delete whole groups of cache files at once. It’s completely self cleaning and also has a method that can be called in a cron job to keep the file-system tidy.

It is intended to be used alongside CodeIgniter’s own caching library.

The code is here http://bitbucket.org/alexbilbie/codeigniter-file-caching-library

Usage

Add something to the cache (returns TRUE if successful)
$this->cache->set( (string)$id, (mixed)$data, (array)$tags, (int)$lifetime );

Get something from the cache (returns FALSE if fail)
$this->cache->get( (string)$id );

Delete an item
$this->cache->delete( (string)$id );

Delete an item by tag (accepts either one tag or an array of tags)
$this->cache->delete_by_tag( (string|array)$tags );

Delete all (this will only delete cache files created by this library, not CodeIgniter’s own caches)
$this->cache->delete_all();

Cleanup (intended for use in a scheduled/cron job)
$this->cache->cleanup();

I hope people find it useful!

One thought on “Very fast file caching library for CodeIgniter

  1. Hi there,
    I was curious about your cache library and the tag system, but the link is not working.

    The library looks really interesting!

    regards,
    goliatone

Leave a Reply

Your email address will not be published.