定制 rickysu/tagcache 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rickysu/tagcache

最新稳定版本:v1.0.3

Composer 安装命令:

composer require rickysu/tagcache

包简介

Provide a cache storage engine and delete with tags

README 文档

README

Build Status

Introduction

This is a cache storage engine.

Features

  • Stores a cache with multiple tags. And deletes cache by using tag.

Requirements

  • PHP 5.3 above

Installation

editing the composer.json file in the root project.

Editing the composer.json under require: {} section add

"rickysu/tagcache": "0.1.*",

Update Composer :

php composer.phar update

driver

The cache driver. Currently support "Memcache,Memcached,File,Sqlite,Apc,Nullcache". Nullcache is for testing only.

hashkey

some driver like Memcached,only support 250 characters key length. Enable this option will use md5 hashed key.

enable_largeobject

Memcache cannot store object over 1MB.Enable these option will fix this issue,but cause lower performance.default false.

servers

Memcache server configs. format => "Host:Port:Weight"

How to Use

Using Tagcache for storing data.

<?php
use RickySu\Tagcache\TagcacheFactory;

$Tagcache=TagcacheFactory::factory(array(
    'driver'   => 'Memcache',
    'namespace' => 'Name_Space_For_Your_Project',
    'options'   => array(
        'hashkey'  => true,
        'enable_largeobject'  =>    false,
        'cache_dir'  =>  'Temp_Cache_File_Store_Path',
        'servers'    => array(
            'localhost:11211:10',
            'otherhost:11211:20',
        ),
    ),    
));

//store cache with Tags:{TagA,TagB} for 300 secs.
$Tagcache->set('Key_For_Store','Data_For_Store',array('TagA','TagB'),300);

//get cache.
$Tagcache->get('Key_For_Store');

//delete cache.
$Tagcache->delete('Key_For_Store');

//delete cache by Tag.
$Tagcache->deleteTag('TagA');

//acquire a lock.If a lock already exists,It will be blocked for 5 secs.
$Tagcache->getLock('Your_Lock_Name',5);

//release a lock.
$Tagcache->releaseLock('Your_Lock_Name');

//increment a cache
$Tagcache->inc('Key_For_increment');

//decrement a cache
$Tagcache->dec('Key_For_decrement');

TODO
----


LICENSE
-------

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-11-19