dev-master
9999999-dev http://www.phpfastcache.comA working fork of PHP Fast Chache library
MIT
The Requires
- php >=5.1.0
cache memcache apc caching memcached apc cache wincache mysql cache php cache files cache pdo cache cache class
A working fork of PHP Fast Chache library
More information at http://www.phpfastcache.com One Class uses for All Cache. You don't need to rewrite your code many times again. Supported: Files, MemCache, MemCached, APC, WinCache, X-Cache, PDO with SQLite, (*1)
Reduce Database Calls, (*2)
Your website have 10,000 visitors who are online, and your dynamic page have to send 10,000 same queries to database on every page load. With phpFastCache, your page only send 1 query to DB, and use the cache to serve 9,999 other visitors., (*3)
<?php /* * Welcome to Learn Lesson * This is very Simple PHP Code of Caching */ // Require Library // Keep it Auto or setup it as "files","sqlite","wincache" ,"apc","memcache","memcached", "xcache" require_once("../phpfastcache/phpfastcache.php"); phpFastCache::setup("storage","auto"); // simple Caching with: $cache = phpFastCache(); // Try to get $products from Caching First // product_page is "identity keyword"; $products = $cache->get("product_page"); if($products == null) { $products = "DB QUERIES | FUNCTION_GET_PRODUCTS | ARRAY | STRING | OBJECTS"; // Write products to Cache in 10 minutes with same keyword $cache->set("product_page",$products , 600); } // use your products here or return it; echo $products;
```php <?php, (*4)
/* * List of function and example */ require_once("../phpfastcache/phpfastcache.php"); $cache = phpFastCache();, (*5)
// Write into cache $cache->set("keyword", "data | array | object", 300);, (*6)
// Read from Cache | return null or data $data = $cache->get("keyword"); echo $data;, (*7)
// Read object information | value | time from cache $object = $cache->getInfo("keyword"); print_r($object);, (*8)
// Delete from cache $cache->delete("keyword");, (*9)
// Clean up all cache $cache->clean();, (*10)
// Stats $array = $cache->stats(); print_r($array);, (*11)
// Increase and Decrease Cache value - Return true | false $cache->increment("keyword", 1); $cache->decrement("keyword", 1);, (*12)
// Extend expiring time - Return true | false; $cache->touch("keyword", 1000);, (*13)
// Check Existing or not - Return true | false; $cache->isExisting("keyword");, (*14)
// Get & Set Multiple Items // Same as above, but input is array();, (*15)
$list = $cache->getMulti(array("key1","key2","key3"));, (*16)
$list = $cache->getInfoMulti(array("key1","key2","key3"));, (*17)
$cache->setMulti(array("key1","value1", 300), array("key2","value2", 600), array("key3","value3", 1800));, (*18)
$cache->deleteMulti(array("key1","key2","key3"));, (*19)
$cache->isExistingMulti(array("key1","key2","key3"));, (*20)
$cache->touchMulti(array( array("key", 300), array("key2", 400), ));, (*21)
$cache->incrementMulti(array( array("key", 1), array("key2", 2), ));, (*22)
$cache->decrementMulti(array( array("key", 1), array("key2", 2), ));, (*23)
````, (*24)
A working fork of PHP Fast Chache library
MIT
cache memcache apc caching memcached apc cache wincache mysql cache php cache files cache pdo cache cache class