werkint/redis-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Bundle providing Redis (namespaced) for services via tags

Installs: 136

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v0.0.1 2014-08-23 11:27 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:25:53 UTC


README

Bundle providing Redis (namespaced) for services via tags

This bundle allows separation of services with namespaces. You tag each service which use Memcached, so when the container is being compiled, each service get an instance of doctrine cache provider with corresponding namespace set. Also this bundle helps store sessions in namespaces.

Also notice, that full namespace for services would be something like "company_dev_theservice_", so you even can have multiple instances of project running on the machine at the same time.

Configuration

framework:
    ...
    session:
        handler_id: werkint.redis.session
werkint_redis:
    host:   localhost
    port:   11211
    prefix: company_%kernel.environment%
    session:
        prefix: company_%kernel.environment%_sess
        expire: 3600
        provider: redis ; or apc

Adding tagged services (namespace: "theservice")

services:
    company.service:
        class: Company\MainBundle\Service\Fooservice
        arguments:
            ...
            - @werkint.redis.ns.theservice
        tags:
            - { name: werkint.redis.cache, scope: project, ns: foo  }
<?php
namespace Company\MainBundle\Service;

use Doctrine\Common\Cache\CacheProvider;

class Service
{
    protected $cacher;

    public function __construct(
        CacheProvider $cacher
    ) {
        $this->cacher = $cacher;
    }

    // You now can use doctrine cache provider as usual

}