寻找基于PHP驱动程序的Cache Wrapper

I am searching for a solution to code cache independent PHP code.

Some kind of Class or Library that provides a cache independent Layer.

So i can start coding and use a file based cache on the beginning and switch to apc/eaccellerator/memcached when the projects load goes up.

I know, thats not hard to code on your own, but thats also the reason why i believe that something like this already exists. And i would prefer using an already tested solution :)

Thanks in advance for you input!

Edit: Sorry guys, but i need a standalone library which should play along nice with existing structures.

This kind of solutions should exist in pretty much any PHP Framework.

For a couple of examples

CodeIgniter has a good cache driver.

Why not create your own cache system, its not really that complex, just have a structure to load drivers, have an API Interface to implement and you should be good

class PHPCache
{
    protected $Driver;
    public function __construct($driver)
    {
        require_once 'drivers/' . $drivers . '.driver.php';
        $driver = "PHPCacheDriver_" . $driver;

        $this->Driver = new $driver;
    }


    public function create($key,$value)
    {
        return $this->Driver->create($key,$value);
    }

    public function read($key,$value)
    {
        return $this->Driver->read($key,$value);
    }

    public function update($key,$value)
    {
         return $this->Driver->update($key,$value);
    }

    public function remove($key)
    {
        return $this->Driver->remove($key);
    }
}

And then each driver implement an interface and CRUD the data accordingly.

PEAR has the Cache package, which has containers for:

  • Database (PEAR DB lib, PEAR MDB2 lib, PHPlib db)
  • File
  • shared memory (SHM)
  • msession

PEAR's Cache_Lite uses files only.