承接 gilbitron/hoard 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gilbitron/hoard

最新稳定版本:0.1.1

Composer 安装命令:

composer require gilbitron/hoard

包简介

PHP caching done right

README 文档

README

Build Status

Hoard is a simple, extensible PHP caching library.

Install

Install via composer:

{
    "require": {
        "gilbitron/hoard": "~0.1.0"
    }
}

Run composer install then use as normal:

require 'vendor/autoload.php';
$cache = new Hoard\Hoard();

API

Hoard uses the conecpt of "drawers" (as in a chest of drawers) as drivers for caching.

$cache = new Hoard\Hoard($drawer = 'file', $options = [], $args = []);

Possible drawers (more to come):

  • file

$options is an array of options passed to the chosen drawer. See Drawers section below.

$args:

  • encrypt_keys - Use encrypted keys (default: true)
  • encryption_function - Function to use for encrypting keys md5/sha1 (default: md5)

Determine if an item exists in the cache

$cache->has($key);

Retrieve an item from the cache by key

$cache->get($key, $default = null);

Retrieve an item from the cache and delete it

$cache->pull($key, $default = null);

Store an item in the cache. $minutes can be an int or DateTime

$cache->put($key, $value, $minutes);

Store an item in the cache if the key does not exist. $minutes can be an int or DateTime

$cache->add($key, $value, $minutes);

Store an item in the cache indefinitely

$cache->forever($key, $value);

Remove an item from the cache

$cache->forget($key);

Remove all items from the cache

$cache->flush();

Drawers

file

Basic FileSystem caching.

Options:

  • cache_dir - Path to cache directory. Uses the system tmp dir if none provided.

Credits

Hoard was created by Gilbert Pellegrom from Dev7studios. Released under the MIT license.

统计信息

  • 总下载量: 125
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-07