2017 © Pedro Peláez
 

library cache

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

image

kba-team/cache

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

  • Wednesday, February 28, 2018
  • by grej
  • Repository
  • 2 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

kbA-Team cache

License: MIT ![Build Status][build-status-master] Maintainability Test Coverage, (*1)

Simple cache implementing PSR-16: Common Interface for Caching Libraries connecting to Redis using PhpRedis., (*2)

Why???

We are aware of the PHP-Cache Project with all sorts of adapters- even for PhpRedis and Predis., (*3)

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., (*4)

Usage

Add to your project

composer require kba-team/cache "^1.1"

We use Semver., (*5)

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., (*6)

Installation

composer install

Run unit tests

A running redis server is required by the unit tests., (*7)

vendor/bin/phpunit

You can set the following environment variables to override the default values expected by the unit tests., (*8)

  • 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:, (*9)

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

The Versions

28/02 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

cache redis predis simple psr-16

28/02 2018

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

cache redis predis simple psr-16