diff --git a/DependencyInjection/Factory/ApcAdapterFactory.php b/DependencyInjection/Factory/ApcAdapterFactory.php new file mode 100644 index 0000000..7642bf3 --- /dev/null +++ b/DependencyInjection/Factory/ApcAdapterFactory.php @@ -0,0 +1,48 @@ + + */ +class ApcAdapterFactory implements AdapterFactoryInterface +{ + /** + * {@inheritDoc} + */ + public function create(ContainerBuilder $container, $id, array $config) + { + $container + ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.apc')) + ->replaceArgument(0, $config['prefix']) + ->replaceArgument(1, $config['ttl']) + ; + } + + /** + * {@inheritDoc} + */ + public function getKey() + { + return 'apc'; + } + + /** + * {@inheritDoc} + */ + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('prefix')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('ttl')->defaultValue(0)->end() + ->end() + ; + } +} diff --git a/README.markdown b/README.markdown index 7b9a3b7..417054a 100644 --- a/README.markdown +++ b/README.markdown @@ -315,3 +315,26 @@ knp_gaufrette: create: true mode: FTP_BINARY ``` + +## Apc + +Adapter for APC. + +A non-persistent adapter, use it in the dev environment, in demo sites, ... + +### Parameters + + * `prefix` The prefix to this filesystem (APC 'namespace', it is recommended that this end in a dot '.') *(required)* + * `ttl` Time to live *(default 0)* + +### Example + +``` yaml +# app/config/config.yml +knp_gaufrette: + adapters: + foo: + apc: + prefix: APC 'namespace' prefix + ttl: 0 +``` diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 1ecddc5..6adc9b2 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -32,6 +32,9 @@ + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index dc75fef..c901c08 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -27,6 +27,10 @@ + + + +