Skip to content

Instantly share code, notes, and snippets.

@basz
Forked from SocalNick/module.config.php
Created March 16, 2012 22:01
Show Gist options
  • Save basz/2053059 to your computer and use it in GitHub Desktop.
Save basz/2053059 to your computer and use it in GitHub Desktop.
Instantiating Zend Cache Adapter using Factory through Di
<?php
return array(
'di' => array(
'definition' => array(
'class' => array(
'Zend\Cache\StorageFactory' => array(
'methods' => array(
'factory' => array(
'cfg' => array(
'required' => true,
),
),
),
),
'Zend\Cache\Storage\Adapter\Memcached' => array(
'instantiator' => array(
'Zend\Cache\StorageFactory',
'factory',
),
),
),
),
'instance' => array(
'alias' => array(
'service-cache' => 'Zend\Cache\Storage\Adapter\Memcached',
),
// Setup the service cache
'service-cache' => array(
'parameters' => array(
'cfg' => array(
'adapter' => array(
'name' => 'Zend\Cache\Storage\Adapter\Memcached',
'options' => array(
'namespace' => 'phantom-services',
'ttl' => 3600,
),
),
'plugins' => array(
'serializer',
),
),
),
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment