Skip to content

Fixes async cache computation example and FQCN #19678

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all 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
12 changes: 6 additions & 6 deletions cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ In the following example, the value is requested from a controller::
public function index(CacheInterface $asyncCache): Response
{
// pass to the cache the service method that refreshes the item
$cachedValue = $cache->get('my_value', [CacheComputation::class, 'compute'])
$cachedValue = $asyncCache->get('my_value', [CacheComputation::class, 'compute'])

// ...
}
Expand All @@ -925,13 +925,13 @@ a message bus to compute values in a worker:
cache:
pools:
async.cache:
early_expiration_message_bus: async_bus
early_expiration_message_bus: messenger.default_bus

messenger:
transports:
async_bus: '%env(MESSENGER_TRANSPORT_DSN)%'
routing:
Symfony\Component\Cache\Messenger\Message\EarlyExpirationMessage: async_bus
'Symfony\Component\Cache\Messenger\EarlyExpirationMessage': async_bus

.. code-block:: xml

Expand All @@ -947,12 +947,12 @@ a message bus to compute values in a worker:
>
<framework:config>
<framework:cache>
<framework:pool name="async.cache" early-expiration-message-bus="async_bus"/>
<framework:pool name="async.cache" early-expiration-message-bus="messenger.default_bus"/>
</framework:cache>

<framework:messenger>
<framework:transport name="async_bus">%env(MESSENGER_TRANSPORT_DSN)%</framework:transport>
<framework:routing message-class="Symfony\Component\Cache\Messenger\Message\EarlyExpirationMessage">
<framework:routing message-class="Symfony\Component\Cache\Messenger\EarlyExpirationMessage">
<framework:sender service="async_bus"/>
</framework:routing>
</framework:messenger>
Expand All @@ -969,7 +969,7 @@ a message bus to compute values in a worker:
return static function (FrameworkConfig $framework): void {
$framework->cache()
->pool('async.cache')
->earlyExpirationMessageBus('async_bus');
->earlyExpirationMessageBus('messenger.default_bus');

$framework->messenger()
->transport('async_bus')
Expand Down