cQL
This is a php coding that enables you to receive higher data via your mysql inquires. You’ll be enable to decrease the users load as well.
How it is working?
When you use this coding in the inquiry field it will use database in the first place and records this data as json format file. This record will be on memcache for a specific arranged time by you.
If you do same inquiry again during arranged time the recorded data will be read and shown to user directly instead of getting data from database.
Sample explanation
For instance let’s assuma 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.
Benchmarking Query
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 = mysql_fetch_assoc($query);
// 1.2859179973602 sec with use only MySQLi
$data = $cql->get("SELECT * FROM table LIMIT 100");
// 0.00059390068054199 sec with use cQL
Requirements
- PHP 5.x
- memcahe extension
- MySQL
Updated
added MySQLi queries on new class file.
you can use mysql : include 'class.cache.php';
you can use mysqli : include 'class.cachei.php';