gilbitron/php-simplecache
最新稳定版本:1.4.2
Composer 安装命令:
composer require gilbitron/php-simplecache
包简介
A simple script for caching 3rd party API calls in PHP.
关键字:
README 文档
README
The PHP SimpleCache Class is an easy way to cache 3rd party API calls.
Install
Install via composer:
{ "require": { "gilbitron/php-simplecache": "~1.4" } }
Run composer install then use as normal:
require 'vendor/autoload.php'; $cache = new Gilbitron\Util\SimpleCache();
Usage
A very basic usage example:
$cache = new Gilbitron\Util\SimpleCache(); $latest_tweet = $cache->get_data('tweet', 'http://search.twitter.com/search.atom?q=from:gilbitron&rpp=1'); echo $latest_tweet;
A more advanced example:
$cache = new Gilbitron\Util\SimpleCache(); $cache->cache_path = 'cache/'; $cache->cache_time = 3600; if($data = $cache->get_cache('label')){ $data = json_decode($data); } else { $data = $cache->do_curl('http://some.api.com/file.json'); $cache->set_cache('label', $data); $data = json_decode($data); } print_r($data);
Credits
PHP SimpleCache was created by Gilbert Pellegrom from Dev7studios. Released under the MIT license.
统计信息
- 总下载量: 36.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 262
- 点击次数: 0
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-25