WorldWideScripts.net Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Miscellaneous

Class Accelerator Cache for PHP

— Add-On to WorldWideScripts.net

Subscribe to our feed to stay up to date!

New! Follow us as you want it!


Class Accelerator Cache for PHP - WorldWideScripts.net Item for Sale

Ads

Ad: Bluehost hosting

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!

Download
Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers

Properties

Created:
20 April 13

Last Update:
25 April 13

Software Version:
PHP 5.x, PHP 5.0 - 5.2, PHP 5.3, PHP 5.4

High Resolution:
No

Files Included:
PHP

Keywords

acelerator, cache, caching, decrypt, encrypt, objects, oop, php