Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
Update caching.rst#7064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Update caching.rst#7064
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -26,24 +26,21 @@ expression saved in the ``ParsedExpression``) and evaluate them on the fly. | ||
To save time, the ``ExpressionLanguage`` caches the ``ParsedExpression`` so | ||
it can skip the tokenize and parse steps with duplicate expressions. | ||
The caching is done by a `CacheItemPoolInterface`_ instance (by default, it uses an | ||
:class:`Symfony\\Component\\Cache\\Adapter\\ArrayAdapter`). | ||
You can customize this by creating a custom ``Cache`` and injecting this | ||
in the object using the constructor:: | ||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage; | ||
useSymfony\Component\Cache\Adapter\RedisAdapter; | ||
$cache = newRedisAdapter(...); | ||
$language = new ExpressionLanguage($cache); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Can we maybe enhance this a bit, to show we're really doing PSR-6 here? E.g. by showing something like: useSymfony\Component\ExpressionLanguage\ExpressionLanguage;useSymfony\Component\Cache\RedisAdapter;$cache =newRedisAdapter(...);$language =newExpressionLanguage($cache); Then, we can add a small "seealso" box pointing to the cache component: ..seealso:: See the:doc:`/components/cache` documentation for more information about available cache adapters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Thank you for your help, I agree, I'll do it as soon as possible :) | ||
..seealso:: | ||
See the :doc:`/components/cache` documentation for more information about | ||
available cache adapters. | ||
Using Parsed and Serialized Expressions | ||
--------------------------------------- | ||
@@ -70,5 +67,4 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and | ||
var_dump($language->evaluate($expression)); // prints 5 | ||
.. _`CacheItemPoolInterface`: https://github.com/php-fig/cache/blob/master/src/CacheItemPoolInterface.php |