2017 © Pedro PelĂĄez
 

library doctrine-cache-detector

Library to detect which Doctrine Cache system is available and determine the best to use.

image

lavoiesl/doctrine-cache-detector

Library to detect which Doctrine Cache system is available and determine the best to use.

  • Monday, April 7, 2014
  • by lavoiesl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 76 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Doctrine Cache Dectector

Detects all available cache layers using Doctrine\Common\Cache, (*1)

Also contains some performance data to select the best available Cache system., (*2)

This can be useful for varying development environments., (*3)

Usage

List all supported caches

getSupportedDetectors();

/**
 * [Apc, Filesystem, PhpFile, etc.]
 */
print_r(array_keys($detectors));

// Doctrine\Common\Cache\ApcCache
$cache = $detectors['Apc']->getCache();
?>

Provide connection options

Provide options for the detector, see each detector for details., (*4)

setConfig('Redis', array('port' => 1234));

// or

$cache_detector->setConfigs(array(
    'Redis' => array('port' => 1234),
));
?>

Select best cache system

This will automatically select the most performant cache system with a requirement on the persistance level., (*5)

On a local machine, ArrayCache will suffice. On a production environment, you may want to require a distributed one., (*6)

selectBest(AbstractDetector::PERSISTANCE_REQUEST)->getCache();
$apc_cache      = $cache_detector->selectBest(AbstractDetector::PERSISTANCE_LOCAL_SERVICE)->getCache();
$file_cache     = $cache_detector->selectBest(AbstractDetector::PERSISTANCE_LOCAL_PERMANENT)->getCache();
$memcache_cache = $cache_detector->selectBest(AbstractDetector::PERSISTANCE_DISTRIBUTED)->getCache();
?>

Todo

  • Add support for MongoDB, Couchbase and Riak.
  • Add better data for performance

Author

The Versions

07/04 2014

dev-master

9999999-dev

Library to detect which Doctrine Cache system is available and determine the best to use.

  Sources   Download

MIT

The Requires

 

The Development Requires

07/04 2014

v2.0

2.0.0.0

Library to detect which Doctrine Cache system is available and determine the best to use.

  Sources   Download

MIT

The Requires

 

The Development Requires

04/04 2014

v1.1

1.1.0.0

Library to detect which Doctrine Cache system is available and determine the best to use.

  Sources   Download

MIT

The Requires

 

26/08 2013

v1.0

1.0.0.0

Library to detect which Doctrine Cache system is available and determine the best to use.

  Sources   Download

MIT

The Requires