bamarni/symfony-http-cache-extension

此包最新版本(dev-master)无可用许可证信息。

dev-master 2013-05-12 13:25 UTC

This package is auto-updated.

Last update: 2024-09-05 22:29:30 UTC


README

Build Status

实验性(WIP)

一些商店 + 自定义 http_cache

Http Cache Doctrine Store

依赖 Doctrine Cache 的 Symfony HttpCache 存储实现。

说明

安装包

将以下依赖项添加到您的 composer.json 文件中

{
    "require": {
        "_some_packages": "...",

        "bamarni/symfony-http-cache-extension": "*"
    }
}

编辑您的项目 HttpCache

配置 Doctrine Cache 驱动并传递给 DoctrineStore

<?php
// app/AppCache.php

use Bamarni\HttpCache\HttpCache;
use Bamarni\HttpCache\Store\DoctrineStore;
//use Doctrine\Common\Cache\ApcCache;
use Doctrine\Common\Cache\MemcacheCache;

class AppCache extends HttpCache
{
    public function createStore()
    {
        // Memcache
        $memcache = new \Memcache;
        $memcache->connect('localhost', 11211);
        $driver = new MemcacheCache;
        $driver->setMemcache($memcache);

        // or APC
        //$driver = new ApcCache;

        return new DoctrineStore($driver);
    }
}