phpfluent/cachebundle

为 Symfony 2 设计的流畅缓存包。

安装: 5

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 1

开放问题: 0

类型:symfony-bundle

dev-master 2013-02-24 21:00 UTC

This package is auto-updated.

Last update: 2024-08-24 03:31:02 UTC


README

为 Symfony 2 设计的流畅缓存包。

安装

composer require phpfluent/cachebundle

更新 settings.yml 文件

services:
    cache:
        class: Doctrine\Common\Cache\ApcCache

注册包

 <?php
 //%/app/AppKernel.php

 $bundles = array(
   new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
   new Symfony\Bundle\TwigBundle\TwigBundle(),
   new Symfony\Bundle\MonologBundle\MonologBundle(),
   new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
   /**
    * Your bundles
    */
   new PHPFluent\Bundle\CacheBundle\CacheBundle(),
 );

在代码中调用它

$cache = $this->get('phpfluent_cache');

$cache['foo'] = 'bar'; //Caching
echo $cache['foo'];//Retrieving from the cache