Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
wouterj merged 1 commit intosymfony:masterfromReDnAxE:patch-5
Nov 10, 2016
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletionscomponents/expression_language/caching.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
:class:`Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface`
instance (by default, it uses an
:class:`Symfony\\Component\\ExpressionLanguage\\ParserCache\\ArrayParserCache`).
You can customize this by creating a custom ``ParserCache`` and injecting this
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;
useAcme\ExpressionLanguage\ParserCache\MyDatabaseParserCache;
useSymfony\Component\Cache\Adapter\RedisAdapter;

$cache = newMyDatabaseParserCache(...);
$cache = newRedisAdapter(...);
$language = new ExpressionLanguage($cache);
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The 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 :)

wouterj reacted with thumbs up emoji

..note::
..seealso::

The `DoctrineBridge`_ provides a Parser Cache implementation using the
`doctrine cache library`_, which gives you caching for all sorts of cache
strategies, like Apc, Filesystem and Memcached.
See the :doc:`/components/cache` documentation for more information about
available cache adapters.

Using Parsed and Serialized Expressions
---------------------------------------
Expand All@@ -70,5 +67,4 @@ Both ``evaluate()`` and ``compile()`` can handle ``ParsedExpression`` and

var_dump($language->evaluate($expression)); // prints 5

.. _DoctrineBridge: https://github.com/symfony/doctrine-bridge
.. _`doctrine cache library`: http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html
.. _`CacheItemPoolInterface`: https://github.com/php-fig/cache/blob/master/src/CacheItemPoolInterface.php

[8]ページ先頭

©2009-2025 Movatter.jp