Jean-Baptiste Nahan ddf7b341da Fix #2
2016-09-01 13:29:25 +02:00
2016-09-01 13:29:25 +02:00
2015-07-24 17:16:38 +02:00
2015-07-22 21:25:35 +02:00
2015-07-22 22:53:56 +02:00
2015-07-28 22:48:08 +02:00
2015-08-05 22:09:43 +02:00

phpcache

Build Status Dependency Status Latest Stable Version Latest Unstable Version License

Supported driver

  • xCache
  • WinCache
  • Predis
  • Redis
  • Memcached
  • Null (special for instanciate no effect cache driver)

Install

php composer.phar require mactronique/phpcache "~1.0"

Configuration

for xCache

No configuration need.

for WinCache

No configuration need.

for Null

No configuration need.

For Predis

$config = array(
	"host" => "127.0.0.1",
	"port" => "",
	"password" => "",
	"database" => "",
	"timeout" => 1,
	"read_write_timeout" => 1
);

Only host key is required.

For Redis

$config = array(
	"host" => "127.0.0.1",
	"port" => "",
	"password" => "",
	"database" => "",
	"timeout" => 1
);

Only host key is required.

For Redis

$config = array(
	"host" => "127.0.0.1",
	"port" => 11211,
	"sharing" => 100
);

Only host key is required.

Example of use NullDriver

This code is example of service class

use Mactronique\PhpCache\Service\PhpCache;
use Mactronique\PhpCache\Driver\NullDriver;

class myService
{
	private $cache
	public function __construct(PhpCache $cache = null)
	{
		if (null === $cache) {
			$cache = new PhpCache();
			$cache->registerDriver(new NullDriver());
		}
		$this->cache = $cache;
	}

	public function myAction()
	{
		/*
		You can use the cache but never key exist and all get return null.
		*/
		$val = $this->cache->get('key');
		[...]
	}
}

Description
No description provided
Readme 87 KiB
Latest
2016-11-09 21:05:18 +01:00
Languages
PHP 100%