DB::DBAL

The World's Most Powerful Light-Weight DBAL

Cache

DB::DBAL is designed to work with APC if available, unless another library is specified using the useCache() method.

The useCache() method works off of the cacheManager, an extension built into the DB class. This method works by initializing the specific cache library found in the classes/cache/ folder. For example, if we create a library extension for memcached, we could implement it by doing the following:

1
DB::cacheManager()->useCache('memcached');

This provides you the ability to use common cache libraries (which will be added in the future), or to build your own custom cache library.

If no cache method is available, DB::DBAL utilizes the temporary memory available to the script while the page loads. While this will help with repeated queries on the same page, this memory is flushed once the script has finished executing.  For larger sites, using APC or another cache method is highly recommended as APC will not only optimize the DB::DBAL code, but optimize and reduce the stress on your database server.

Supported Cache Libraries:

  • APC