承接 herroffizier/limcache 相关项目开发

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

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

herroffizier/limcache

Composer 安装命令:

composer require herroffizier/limcache

包简介

Non-persistent cache manager with LRU and MRU algorithms

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Code Climate

Limcache is a small non-persistent cache manager that supports LRU and MRU replacement algorithms. Also it has optional Judy support.

Requirements

  • PHP >= 5.4
  • Judy (optional)

Installation

You can install Limcache via Composer:

composer require herroffizier/limcache:dev-master

Usage

At first, choose replacement algorithm:

// Use LRU:
$strategy = new \Limcache\strategy\LRU(100); // 100 is max item count in cache

// Or MRU:
$strategy = new \Limcache\strategy\MRU(100);

After that you can create cache:

$cache = new \Limcache\Cache($strategy);

Since \Limcache\Cache implements \ArrayAccess and \Countable interfaces you can use it as array in most cases:

// Save item in cache:
$cache['key1'] = 'somedata';

// Get item value:
$cache['key1'];

// Try to get non-existent item:
$cache['key2']; // will return null

// Do some ordinary things:
count($cache);
isset($cache['key1']);
unset($cache['key1']);

In addition cache object has few useful methods which may help to determine cache efficiency:

// Get cache hits:
$cache->getHits();

// Get cache misses:
$cache->getMisses();

统计信息

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

GitHub 信息

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

其他信息

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