Skip to content

Commit

Permalink
Added documentation for result caching in QueryBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
twoleds committed Jul 28, 2022
1 parent 27928af commit 193465a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/en/reference/query-builder.rst
Expand Up @@ -369,3 +369,26 @@ in your query as a return value:
->where('email = ' . $queryBuilder->createPositionalParameter($userInputEmail))
;
// SELECT id, name FROM users WHERE email = ?
Caching
-------

To use the result cache, it is necessary to call the method
``enableResultCache($cacheProfile)`` and pass a instance of
``Doctrine\DBAL\Cache\QueryCacheProfile`` with lifetime in seconds.
Optionally can be specified cache key.

.. code-block:: php
<?php
$queryBuilder
->select('id', 'name')
->from('users')
->enableResultCache(new QueryCacheProfile(300, 'some-key'))
;
.. note::

For more details and how to configure the result cache check caching section in
documentation.

0 comments on commit 193465a

Please sign in to comment.