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

[Cache] Document using DSN with PDOAdapter#19416

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
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
29 changes: 8 additions & 21 deletionscache.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,12 +133,7 @@ Some of these adapters could be configured via shortcuts.
default_psr6_provider: 'app.my_psr6_service'
default_redis_provider: 'redis://localhost'
default_memcached_provider: 'memcached://localhost'
default_pdo_provider: 'app.my_pdo_service'

services:
app.my_pdo_service:
class: \PDO
arguments: ['pgsql:host=localhost']
default_pdo_provider: 'pgsql:host=localhost'

.. code-block:: xml

Expand All@@ -159,24 +154,17 @@ Some of these adapters could be configured via shortcuts.
default-psr6-provider="app.my_psr6_service"
default-redis-provider="redis://localhost"
default-memcached-provider="memcached://localhost"
default-pdo-provider="app.my_pdo_service"
default-pdo-provider="pgsql:host=localhost"
/>
</framework:config>

<services>
<service id="app.my_pdo_service" class="\PDO">
<argument>pgsql:host=localhost</argument>
</service>
</services>
</container>

.. code-block:: php

// config/packages/cache.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework, ContainerConfigurator $container): void {
return static function (FrameworkConfig $framework): void {
$framework->cache()
// Only used with cache.adapter.filesystem
->directory('%kernel.cache_dir%/pools')
Expand All@@ -185,15 +173,14 @@ Some of these adapters could be configured via shortcuts.
->defaultPsr6Provider('app.my_psr6_service')
->defaultRedisProvider('redis://localhost')
->defaultMemcachedProvider('memcached://localhost')
->defaultPdoProvider('app.my_pdo_service')
;

$container->services()
->set('app.my_pdo_service', \PDO::class)
->args(['pgsql:host=localhost'])
->defaultPdoProvider('pgsql:host=localhost')
;
};

.. versionadded:: 7.1

Using a DSN as the provider for the PDO adapter was introduced in Symfony 7.1.

.. _cache-create-pools:

Creating Custom (Namespaced) Pools
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp