werkint / memcached-bundle
此包已被弃用且不再维护。没有建议的替代包。
通过标签为服务提供命名空间化的Memcached的包
1.0.0
2013-06-30 15:36 UTC
Requires
- php: >=5.4
- doctrine/cache: *
This package is not auto-updated.
Last update: 2022-02-01 12:25:48 UTC
README
通过标签为服务提供命名空间化的Memcached的包
此包允许通过命名空间分离服务。您为使用Memcached的每个服务添加标签,因此当容器正在编译时,每个服务都会获得一个具有相应命名空间的doctrine缓存提供程序的实例。此外,此包还帮助在命名空间中存储会话。
请注意,服务的完整命名空间可能是类似于 "company_dev_theservice_" 的样子,因此您甚至可以在同一台机器上同时运行多个项目实例。
配置
framework: ... session: handler_id: werkint.memcached.session werkint_memcached: host: localhost port: 11211 prefix: company_%kernel.environment% session: prefix: company_%kernel.environment%_sess expire: 3600
添加已标记的服务(命名空间:"theservice")
services:
company.service:
class: Company\MainBundle\Service\Service
arguments:
...
- @werkint.memcached.ns.theservice
tags:
- { name: werkint.memcached.cacher, ns: theservice }
<?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 }