Giter VIP home page Giter VIP logo

liipdoctrinecachebundle's Introduction

DoctrineCacheBundle

This Bundle provides integration into Symfony2 with the Doctrine Common Cache layer

Installation

1. Add this bundle to your project:

Using submodules

$ git submodule add git://github.com/liip/LiipDoctrineCacheBundle.git vendor/bundles/Liip/DoctrineCacheBundle

Using the vendors script

Add the following lines in your deps file:

[LiipDoctrineCacheBundle]
    git=git://github.com/liip/LiipDoctrineCacheBundle.git
    target=/bundles/Liip/DoctrineCacheBundle

Now, run the vendors script to download the bundle:

$ php bin/vendors install

2. Add the Liip namespace to your autoloader:

<?php
// app/autoload.php
$loader->registerNamespaces(array(
    'Liip' => __DIR__.'/../vendor/bundles',
    // your other namespaces
));

3. Add this bundle to your application's kernel:

<?php
// application/ApplicationKernel.php
public function registerBundles()
{
  return array(
      // ...
      new Liip\DoctrineCacheBundle\LiipDoctrineCacheBundle(),
      // ...
  );
}

Configuration

Simply configure any number of cache services:

# app/config.yml
liip_doctrine_cache:
    namespaces:
        # name of the service (aka liip_doctrine_cache.ns.foo)
        foo:
            # cache namespace is "ding", this is optional
            namespace: ding
            # cache type is "apc"
            type: apc
        # name of the service (aka liip_doctrine_cache.ns.lala) and namespace
        lala:
            # cache type is "apc"
            type: apc
        # name of the service (aka liip_doctrine_cache.ns.bar)
        bar:
            # cache namespace is "dong"
            namespace: dong
            # cache type is "memcached"
            type: memcached
            # name of a service of class Memcached that is fully configured (optional)
            id: my_memcached_service
            # port to use for memcache(d) (default is 11211)
            port: 11211
            # host to use for memcache(d) (default is localhost)
            host: localhost

Usage

Simply use liip_doctrine_cache.ns.[your_name] in dependency injection config files or using $container->get('liip_doctrine_cache.ns.[your_name]') in your code.

Custom cache types

Simply define a new type by defining a service named liip_doctrine_cache.[type name]. Note the service needs to implement Doctrine\Common\Cache\Cache interface.

liipdoctrinecachebundle's People

Contributors

lsmith77 avatar jrmyio avatar jakzal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.