phpFastCache 介绍
PHPFastCache 是一个开源的 PHP 缓存库,只提供一个简单的 PHP 文件,可方便集成到已有项目,支持多种缓存方法,包括:apc,
memcache, memcached, wincache, files, pdo and mpdo。可通过简单的 API 来定义缓存的有效时间。
示例代码:
<?PHP // In your config file include("PHP_fast_cache.PHP"); // This is Optional Config only. You can skip these lines. // PHPFastCache support "apc", "memcache", "memcached", "wincache" ,"files", "pdo", "mpdo" and "xcache" // You don't need to change your code when you change your caching system. Or simple keep it auto PHPFastCache::$storage = "auto"; // End Optionals // In your Class, Functions, PHP Pages // try to get from Cache first. $products = PHPFastCache::get("products_page"); if($products == null) { $products = YOUR DB QUERIES || GET_PRODUCTS_FUNCTION; // set products in to cache in 600 seconds = 10 minutes PHPFastCache::set("products_page",$products,600); } foreach($products as $product) { // Output Your Contents HERE } ?>
phpFastCache 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。