phpro / annotated-cache-bundle
该包已被废弃,不再维护。未建议替代包。
为 phpro/annotated-cache 包提供 Symfony 桥接器
v0.1.2
2016-05-09 07:27 UTC
Requires
- php: ~7.0
- phpro/annotated-cache: ~0.2
- symfony/dependency-injection: ^3.0|^2.8
- symfony/http-kernel: ^3.0|^2.8
- symfony/web-profiler-bundle: ^3.0|^2.8
Requires (Dev)
Suggests
- cache/cache: This package provides a set of PSR6 pool adapters and a taggable implementation.
This package is auto-updated.
Last update: 2020-12-22 10:24:05 UTC
README
仓库自 2020-11-27 起已废弃
由于我们不再内部使用此仓库,因此已将其存档。请随意使用它,我们将不再提供任何支持。
注解缓存包
安装
composer require phpro/annotated-cache-bundle
# AppKernel.php public function registerBundles() { $bundles = [ // Bundles .... new Phpro\AnnotatedCacheBundle\AnnotatedCacheBundle(), ]; return $bundles; }
注意:如果您想使用具有多个标签的缓存服务,建议尽早注册此包。
配置
# Default configuration for extension with alias: "annotated_cache" annotated_cache: key_generator: phpro.annotated_cache.keygenerator.expressions proxy_config: cache_dir: '%kernel.cache_dir%/annotated_cache' namespace: AnnotatedCacheGeneratedProxy register_autoloader: true pools: # Example: poolname: service: service.key
生成代理
services: app.manager.products: class: App\Manager\ProductsManager tags: - { name: 'annotated_cache.eligable' }
您可以将自己的服务注册为使用缓存代理。您需要做的唯一一件事就是将服务标记为具有 annotated_cache.eligable
标签。
配置您自己的拦截器
services: app.interceptor.my_interceptor: class: App\Interceptor\MyInterceptor tags: - { name: 'annotated_cache.interceptor' }
添加您自己的功能很简单。创建您自己的 InterceptorInterface
并将其标记为 annotated_cache.interceptor
。