承接 thefuriouscoder/doctrine-cache-factory 相关项目开发

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

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

thefuriouscoder/doctrine-cache-factory

Composer 安装命令:

composer require thefuriouscoder/doctrine-cache-factory

包简介

A simple static wrapper for Docrine Cache drivers.

README 文档

README

Total Downloads

A simple static wrapper for Doctrine Cache drivers.

Requirements

Install

Composer

Add a dependency on thefuriouscoder/doctrine-cache-factory to your project's composer.json file.

{
    "require": {
        "thefuriouscoder/doctrine-cache-factory": "dev-master"
    }
}

Configuration

Initialize the Cache Store.

Add the following configuration code to your project bootstraping file depending on the storage you are goinng to use.

Using Memcached (php5-memcached extension needed)

// configure memcached setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'memcached',
        'prefix'      => 'rlyeh',
        'default_ttl' => 3600,
        'servers'     => [
            ['server1', 11211, 20],
            ['server2', 11211, 80]
        ]
    ]
);

Using APC

// configure APC setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'apc',
        'default_ttl' => 3600
    ]
);

Using Redis

// configure Redis setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'redis',
        'prefix'      => 'rlyeh',
        'host         => '127.0.0.1',
        'port'        => 6379,
        'default_ttl' => 3600
    ]
);

Basic usage

$cache = \TFC\Cache\DoctrineCacheFactory::factory("redis");
$cache->setNamespace("miskatonic");
$cache->save($key,$data);
$cache->contains($key);
$data = $cache->fetch($key);
$cache->delete($key);
$cache->deleteAll();

For more detailed instructions on Doctrine cache usage, please refer to doctrine documentation

License

MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-05