2017 © Pedro PelĂĄez
 

library doctrine-cache-factory

A simple static wrapper for Docrine Cache drivers.

image

thefuriouscoder/doctrine-cache-factory

A simple static wrapper for Docrine Cache drivers.

  • Thursday, November 5, 2015
  • by thefuriouscoder
  • Repository
  • 1 Watchers
  • 1 Stars
  • 222 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 16 % Grown

The README.md

Doctrine Cache factory

Total Downloads, (*1)

A simple static wrapper for Doctrine Cache drivers., (*2)

Requirements

Install

Composer

Add a dependency on thefuriouscoder/doctrine-cache-factory to your project's composer.json file., (*3)

{
    "require": {
        "thefuriouscoder/doctrine-cache-factory": "dev-master"
    }
}

Configuration

Initialize the Cache Store.

Add the following configuration code to your project bootstraping file depending on the storage you are goinng to use., (*4)

Using Memcached (php5-memcached extension needed)

// configure memcached setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'memcached',
        'prefix'      => 'rlyeh',
        'default_ttl' => 3600,
        'servers'     => [
            ['server1', 11211, 20],
            ['server2', 11211, 80]
        ]
    ]
);

Using APC

// configure APC setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'apc',
        'default_ttl' => 3600
    ]
);

Using Redis

// configure Redis setting.
TFC\Cache\DoctrineCacheFactory::setOption(
    [
        'storage'     => 'redis',
        'prefix'      => 'rlyeh',
        'host         => '127.0.0.1',
        'port'        => 6379,
        'default_ttl' => 3600
    ]
);

Basic usage

$cache = \TFC\Cache\DoctrineCacheFactory::factory("redis");
$cache->setNamespace("miskatonic");
$cache->save($key,$data);
$cache->contains($key);
$data = $cache->fetch($key);
$cache->delete($key);
$cache->deleteAll();

For more detailed instructions on Doctrine cache usage, please refer to doctrine documentation, (*5)

License

MIT License, (*6)

The Versions

05/11 2015

dev-master

9999999-dev

A simple static wrapper for Docrine Cache drivers.

  Sources   Download

MIT

The Requires

 

by Diego Rin MartĂ­n

cache wrapper doctrine factory