Download the PHP package bigpaulie/cachebundle without Composer
On this page you can find all versions of the php package bigpaulie/cachebundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bigpaulie/cachebundle
More information about bigpaulie/cachebundle
Files in bigpaulie/cachebundle
Package cachebundle
Short Description This bundle provides some extra functionality for multi-domain and ORM caching
License MIT
Informations about the package cachebundle
CacheBundle
This bundle provides some extra functionality to the cache layer by exposing a service and a trait in order to make it easier for you to cache your queries.
At the moment this bundle works with Symfony 2.8.x PHP 5.6, PHP 7 and MySQL/MariaDB
Installation
The preferred way to install the bundle is via composer
After requiring the package you should add the bundle to your bundle array in the AppKernel.php
Import the services.yml in your config.yml at the top of the file
Add a new parameter in parameters.yml
Enable/disable caching for specific environments
Place the following in your config_*.yml file
Tell doctrine to use a given cache driver
Query Caching
The bundle follows the official API as described in the documentation at Doctrine Project
DQL Caching
The setQueryCaching() method supports two additional parameters: lifetime and key.
Entity Caching
Symfony Framework doesn't support entity caching out of the box, here enters the Cacheable trait. Use the Cacheable trait in the repositories you want to cache.
Overridden methods:
find()
If you specify a lifetime for your cache than the result will be cached.
Additionally there is a third parameter to which you can pass an Closure which will act like a default return in case the query doesn't return any result.
findOneBy()
If you specify a lifetime for your cache than the result will be cached.
Additionally you can also pass a Closure as the forth parameter which will act as a default return if the query doesn't return any results.
findAll()
If you specify a lifetime for your cache than the result will be cached.
Additionally you can also pass a Closure as the second parameter which will act as a default return if the query doesn't return any results.
Example Usage
Contribution
Feel free to contribute to this project, together we can make it a better project.
Fork, code, submit a pull request or open a issue.