PHP cache system
I am wondering if some one knows good sites where I can find useful information in regards to PHP based cache systems and how to make one. Since I want to reduce the stress on MySQL which is being called every 60 se开发者_如何学JAVAc via jQuery AJAX function.
- You can use MP_Cache for simple php based caching needs.
- If you are looking for a distributed caching solution then consider memcached. PHP has nice integration with memcache as described here: http://php.net/manual/en/book.memcache.php
- Alternative PHP cache is another option you may consider.
well ajax / jquery is immense at bandwidth usage, you can cache the results
look here for example: http://blog.digitalstruct.com/2008/02/27/php-performance-series-caching-techniques/
but you cant reduce so much the bandwidth usage of jquery but you can trim down the size of the websites, scripts and also the database (better database scheme)
I would suggest you to use Super Cache, which is a file cache mechanism which won't use json_encode
or serialize
. It is simple to use and really fast compared to other PHP Cache mechanism.
Simple PHP cache mechanism which is 500X Faster Caching than Redis/Memcache/APC in PHP & HHVM https://packagist.org/packages/smart-php/super-cache
Ex:
<?php
require __DIR__.'/vendor/autoload.php';
use SuperCache\SuperCache as sCache;
//Saving cache value with a key
// sCache::cache('<key>')->set('<value>');
sCache::cache('myKey')->set('Key_value');
//Retrieving cache value with a key
echo sCache::cache('myKey')->get();
?>
精彩评论