Skip to content

Commit

Permalink
Added docs how to use Symfony cache (#166)
Browse files Browse the repository at this point in the history
* Added docs how to use Symfony cache

* Ony test doctrine stuff

* Moved comment
  • Loading branch information
Nyholm authored Sep 3, 2017
1 parent d6e96f8 commit 8c9a025
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ matrix:
- php: 7.0
env: TEST_COMMAND="composer test-ci" COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_VERSION=3.3.* COVERAGE=true
- php: 7.0
env: TEST_COMMAND="phpunit" COMPOSER_FLAGS="--prefer-source" SYMFONY_VERSION="3.3.* phpunit/phpunit:^5.7"
# We need `--prefer-source`, otherwise the `Doctrine\Tests\OrmTestCase` class won't be found.
env: TEST_COMMAND="phpunit --testsuite doctrine" COMPOSER_FLAGS="--prefer-source" SYMFONY_VERSION="3.3.* phpunit/phpunit:^5.7"
- php: 7.1
env: SYMFONY_VERSION=4.0.*

before_script:
- composer require symfony/symfony:${SYMFONY_VERSION} --no-update
# This command must be run with `--prefer-source`, otherwise the `Doctrine\Tests\OrmTestCase` class won't be found.
- composer update $COMPOSER_FLAGS

script:
Expand Down
39 changes: 39 additions & 0 deletions Resources/doc/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,42 @@ servies:
## Installing a PSR16 cache

You may use any adapter from [PHP-cache.com](http://www.php-cache.com/en/latest/) or `symfony/cache`.

## Using Symfony cache

Symfony 3.3 does not support SimpleCache, but fear not. You can use a bridge between PSR-6 and PSR-16. Install the
[bridge](https://github.com/php-cache/simple-cache-bridge) by:

```bash
composer require cache/simple-cache-bridge
```

Then register a service:

```yaml
# services.yml
app.simple_cache:
class: Cache\Bridge\SimpleCache\SimpleCacheBridge
arguments: ['@app.cache.acme']
```

Then configure the framework and the bundle.

```yaml
# config.yml
framework:
cache:
app: cache.adapter.redis
pools:
app.cache.acme:
adapter: cache.app
default_lifetime: 600
bazinga_geocoder:
providers:
my_google_maps:
factory: Bazinga\GeocoderBundle\ProviderFactory\GoogleMapsFactory
cache: 'app.simple_cache'
cache_lifetime: 3600
```

0 comments on commit 8c9a025

Please sign in to comment.