定制 kba-team/cache 二次开发

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

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

kba-team/cache

最新稳定版本:1.1.1

Composer 安装命令:

composer require kba-team/cache

包简介

Simple cache implementing PSR-16 connecting to Redis using PhpRedis.

README 文档

README

License: MIT Build Status Maintainability Test Coverage

Simple cache implementing PSR-16: Common Interface for Caching Libraries connecting to Redis using PhpRedis.

Why???

We are aware of the PHP-Cache Project with all sorts of adapters- even for PhpRedis and Predis.

We were in need of a simple cache solution just for Redis without all the bells and whistles of PSR-6 and without all the abstraction layers necessary to implement multiple storage backends.

Usage

Add to your project

composer require kba-team/cache "^1.1"

We use Semver.

Single redis server via TCP

<?php
//create object to access the redis server
$redis = \kbATeam\Cache\Redis::tcp('redis-server', 10);
//store value in redis server
if (!$redis->has('hello')) {
    $redis->set('hello', 'Hello World!');
}
//retrieve value from redis server
echo $redis->get('hello');

Testing

Testing requires a running redis server.

Installation

composer install

Run unit tests

A running redis server is required by the unit tests.

vendor/bin/phpunit

You can set the following environment variables to override the default values expected by the unit tests.

  • REDIS_SERVER_HOST: The hostname or IP address of the redis server. Default: 127.0.0.1
  • REDIS_SERVER_PORT: The TCP port the redis server is listening on. Default: 6379
  • REDIS_SERVER_DBINDEX: The database to use on the redis server. Default: 0
  • REDIS_SERVER_PASSWORD: The password used to access the redis server. Default: no password.

Starting a redis docker container

docker run \
    --rm \
    --init \
    --detach \
    --name redis-server \
    redis:3.0

Get the containers' IP address:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis-server

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-26