itinance/doctrine-cache-adapter-with-site-context

该包最新版本(v0.3)没有提供许可证信息。

v0.3 2017-04-03 20:43 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:53:39 UTC


README

如果你正在使用 Emanuele Minotto 的 TwigCacheBundle 和 Simon Ocho 的 white-label-bundle (https://github.com/simonoche/white-label-bundle),你可能会遇到缓存问题。

这个类是 TwigCacheBundle 中使用的 Cache Adapter 的替代品,以在白标/多站点环境中尊重当前站点上下文。

安装

使用 composer 进行安装

    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:itinance/DoctrineCacheAdapterWithSiteContext.git"
        }
    ],
    "require": {
        "itinance/DoctrineCacheAdapterWithSiteContext": "dev-master"
    },

配置

在 app/config/services.yml 中添加以下内容

    twig_cache.adapter:
        class: itinance\DoctrineCacheAdapterWithSiteContext
        arguments:
            - @cache_service
            - @site_context

@cache_service 可以配置如下

    memcached:
        class: Memcached
        calls:
            - [ addServers, [ %memcached.servers% ] ]

    cache_service:
        class: Doctrine\Common\Cache\MemcachedCache
        calls:
            - [ setMemcached, [ @memcached ] ]