Class Accelerator Cache for PHP

Last Update
24 April 2013
Regular License
$10
Extended License
$50
Sales
1

Update 4-24-2013: Submitted a patch (version 1.3) that fixed an error introduced in 1.2. Currently stable and working as expected. See FAQ until update is approved.

Update: 4-23-2013: Released a patch (version 1.2) that fixed an error when cache files were empty or possibly corrupt.

Update: 4-20-2013: Added a live preview that contains the documentation and the following explanation.

The Class Accelerator Cache for PHP provides a caching system for PHP 5 object oriented programming methods and techniques. It allows for the automatic caching of object functions without the need to write or add new code to your class’s functions or implementation.

It also preserves objects methods or properties and allows for encryption and decryption.

When you have a class that contains a lot of functions, such as a class that interacts with your database, you may want to cache the results to reduce the load on your server and make your web app or site run faster. Other caching systems require that you write a bunch of code inside your functions, which really hurts the readability and maintainability of your functions and class in the future. This is where Class Accelerator Cache for PHP differs.

Class Accelerator Cache for PHP is a ‘wrapper’ or decorator class that sits on top of your existing class and automatically implements the caching system for you – without having to rewrite your functions. Here is a very basic example:

class UserDatabase {

function getUser($user_id) { try { $db = new PDO('mysql:host=localhost;port=3306;dbname=users', 'root', ''); $db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $db -> prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1;'); $stmt -> execute(array($userID));

$user = NULL;

while ($result = $stmt -> fetchObject()) { $user = $result; } return $user; } catch (PDOException $e) { return NULL; } } }

// Create a new instance of our user database. $db = new UserDatabase()

// Add the caching system to our user database. $db = new ClassAcceleratorCache($db, $options);

// Now our user database class's functions will be cached!