Database abstraction layer on PHP with cache
There are many Database abstraction (DBA) for PHP, the well known PDO (PHP Database Object) is a good implementation of a DBA. The small problem is that PDO is only for PHP5, and therefore there many web developers (like me) are not able to use PDO because most of our work was code for PHP4, and PHP5 has many backwards incompatible changes with previous versions.
In a past project, I was working with PDO, and I had a I really good experience with it, I really liked the unique interface, the statement prepare, and many other features of PDO. So, the past week I start to write a PDO like (not equal) PHP class for PHP (4 and greater).
While I was working on this project, I saw that the cache of contents for avoid database access (see this post and this class) sometimes require an additional effort to implement, but there is many benefits such as, off load database, better response time.
Most of time, cache is for avoid database connection, the fastest database applications are those that avoid accessing the database as much as possible (read this post), based on that affirmation, my class has a built-in cache system, and therefore he connects to database only when is absolutely needed.
In the Online Documentation you can find the API, and examples of how to work with this class.
Another important factor, is that this class is protected under a BSD License, which permits you to include part or the whole class into a proprietary project without any fee, and you can have free support here.
This class can be freely download from here
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
December 5th, 2007 at 12:25 pm
I’ve been looking over your abstraction layer because I’m interested in developing a similar cache system for a web site I run.
I run PHP 5.2, MySQL 5.0 and wondered how something similar to your abstraction layer can be done taking advantage of MySQLi and MySQL 5.0 specifically. For example, MySQL > 5.0 allows prepared queries using two parameters in LIMIT.
Any chance of us speaking about it? Email me if interested.
Thanks!!
January 22nd, 2008 at 5:50 pm
Very useful, thanks!
Why don’t you speak more about it?