This is a php coding that enables you to receive higher volume of data with your mysql inquires. You’ll be enable to decrease the load on your users.
How it is working?
When you use this coding in the inquiry field it will record the data as json format to the database in the first place. This record will be saved on memcache for a specific time set by you. If you do same inquiry during that specific time again the recorded data will be read and shown to user directly instead of getting data from database.
For instance let’s assume that you have a video sharing site and getting data from database and shown to users. You’ll compulsorily do the same action again and again for each user and repeated mysql connection occurs. Instead of following this process again and again you can use this coding to keep your server less busy and get success easier.
MySQL : $query = mysql_query("SELECT * FROM table LIMIT 100"); $data = mysql_fetch_assoc($query); // 1.2934579849243 sec with use only MySQL MySQLi $query = mysqli_query($con,"SELECT * FROM table LIMIT 100"); $data = mysqli_fetch_assoc($query); // 1.2859179973602 sec with use only MySQLi $data = $cql->get("SELECT * FROM table LIMIT 100"); // 0.00059390068054199 sec with use cQL
- PHP 5.x
- memcahe extension
added pdo and mysqli queries on new class file. include 'class.cache.php'; $cql = new cql; use pdo : $cql->using("pdo"); use mysqli : $cql->using("mysqli"); use mysql : $cql->using("mysql"); or change class file : public $using = "mysql"; // mysql - mysqli - pdo