2017 © Pedro Peláez
 

symfony-bundle elasticache-bundle

An ElastiCache Bundle for Symfony.

image

igniter/elasticache-bundle

An ElastiCache Bundle for Symfony.

  • Wednesday, October 14, 2015
  • by jaredm4
  • Repository
  • 10 Watchers
  • 2 Stars
  • 3,723 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

ElastiCacheBundle

An ElastiCache Bundle for Symfony. This could also be used for Redis Clusters that aren't in ElastiCache as well. To that end, we use typical "master" and "slave" nomenclature instead of ElastiCache's "primary" and "read" node names., (*1)

Codeship Status for ShopIgniter/ElastiCacheBundle Coverage Status, (*2)

Installation

To enable the RedisCache service, add your servers to your parameters.yml., (*3)

parameters:
    # ...
    cache.redis.servers:
        - { host: primary-write.ng.amazonaws.example.com, port: 6379, master: true, timeout: 5 }
        - { host: primary-read.amazonaws.example.com, port: 6379, timeout: 5 }
        - { host: read-1.amazonaws.example.com, port: 6379, timeout: 5 }

Notes

The Master host and port come from ElastiCache's Replication Group Primary Endpoint. Do not use the node's endpoint for writing. Likewise, do not use the Replication Group's Primary Endpoint as a read server. Instead use the primary node's endpoint for reading., (*4)

Usage

To use directly, grab the service from the container., (*5)

/** @var \Igniter\ElastiCacheBundle\Cache\RedisCache $cache */
$cache = $this->get('igniter.elasticache.rediscache');
$bar = $cache->fetch('foo');
// ...
$cache->save('foo', $bar);

To use as a Doctrine Custom Cache Provider, use the following in your config. Using aliases, you can also retrieve the service by this alias out of the container., (*6)

doctrine_cache:
    aliases:
        cache: my_provider
    custom_providers:
        igniter.elasticache:
            prototype:  "igniter.elasticache.rediscache"
            definition_class: "Igniter\ElastiCacheBundle\DependencyInjection\Definition\RedisCacheDefinition"
    providers:
        my_provider:
            igniter.elasticache:
                namespace: "foo"

ToDo

The Versions