rcastera / apc
APC 缓存
v1.0.0
2013-09-21 05:15 UTC
Requires
- php: >=5.3.0
- ext-apc: *
This package is not auto-updated.
Last update: 2024-09-24 04:43:52 UTC
README
PHP 替代缓存(APC)是一个免费和开源的 PHP 指令缓存。其目标是提供免费、开源和健壮的缓存和优化 PHP 中间代码的框架。此类以简单形式提供,是对 APC 库的抽象。
设置
将 composer.json
文件添加到您的项目中
{ "require": { "rcastera/apc": "v1.0.0" } }
然后,假设您已安装了 composer,您可以运行以下命令
$ composer.phar install
这将从您的 vendor 文件夹中获取库及其依赖项。然后,您可以将以下内容添加到您的 .php 文件中以使用该库
require 'vendor/autoload.php';
然后您需要使用相关类,例如
use rcastera\Apc\ApcCache;
示例
require 'vendor/autoload.php'; use rcastera\Apc\ApcCache; // Create a new object with properties to store in cache. $object = new stdClass; $object->name = 'Richard'; $object->age = 30; // Store the object in cache. ApcCache::store('rich', $object, 3600); // Now check if it exists and fetch it. if (ApcCache::exists('rich')) { $person = ApcCache::fetch('rich'); } // Output the name property value. echo $person->name; // Delete this specific key in cache. ApcCache::delete('rich'); // Delete all cache. ApcCache::clear();
贡献
- 进行分支
- 创建分支(
git checkout -b my_branch
) - 提交您的更改(
git commit -am "Added something"
) - 将分支推送到远程(
git push origin my_branch
) - 创建一个[问题][1],其中包含对您的分支的链接
- 享用一杯清凉的可乐并等待