Skip to content

Commit

Permalink
Document PSR-6 cache adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanlaak committed May 31, 2016
1 parent 37aa9e1 commit 6f5d595
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ twig_cache:
service: cache_service # instance of Doctrine\Common\Cache\Cache
```

Another option is to configure one of the PSR-6 Cache pool implementations
by changing the default adapter class to the `PsrCacheAdapter`.

```yml
# parameters.yml
twig_cache.adapter.class: Asm89\Twig\CacheExtension\CacheProvider\PsrCacheAdapter
```

After that any cache pool that implements the `CacheItemPoolInterface` is
supported. The [`CacheBundle`](https://github.com/php-cache/cache-bundle) will
allow you to configure the cache pool of your choice. List of predefined pools
can be found at: [http://php-cache.readthedocs.io/](http://php-cache.readthedocs.io/)

```yml
# config.yml
cache_adapter:
providers:
twig_apcu:
factory: 'cache.factory.apcu'

twig_cache:
service: cache.provider.twig_apcu
```

Usage
-----

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"asm89/twig-cache-extension": "^1.0"
"asm89/twig-cache-extension": "^1.3"
},
"require-dev": {
"doctrine/cache": "^1.4",
Expand All @@ -38,6 +38,8 @@
}
},
"suggest": {
"itinance/doctrine-cache-adapter-with-site-context": "a Cache Adapter used to respect the current site context in a white-label/multi-site environment"
"itinance/doctrine-cache-adapter-with-site-context": "a Cache Adapter used to respect the current site context in a white-label/multi-site environment",
"cache/adapter-bundle": "To make use of PSR-6 cache implementation via PsrCacheAdapter.",
"cache/cache-bundle": "To easily be able to configure adapters in your Symfony application."
}
}

0 comments on commit 6f5d595

Please sign in to comment.