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

[FrameworkBundle] Add cache adapters in semantic configuration#18625

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

Closed
tgalopin wants to merge1 commit intosymfony:masterfromtgalopin:cache-config

Conversation

@tgalopin
Copy link
Contributor

@tgalopintgalopin commentedApr 23, 2016
edited by nicolas-grekas
Loading

QA
Branch?3.1
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Following other PRs about the integration of the Cache component into the FrameworkBundle, this PR proposes the possibility to define and overide adapters from the semantic configuration.

There are three main reasons why I think we should be able to configure adapters from theconfig_*.yml files:

  • to be consistent with cache pools
  • because it's very useful to be able to override local/shared adapters dependeing on the environment
  • because it's easier to understand the Cache components concepts in simple YAML configuration than with services (currently, to override adapters, we need to define services).

Here is an example of how we could configure every shared cache of the application to use redis instead of the filesystem with this proposal:

framework:cache:adapters:shared:parent:cache.adapter.redisprovider:app.redis_connection

By default, the FrameworkBundle defines some useful adapters and pools. Using this proposal configuration, we can represent these adapters and pools like these:

framework:#...cache:adapters:apcu:parent:~default_lifetime:~provider:~doctrine:parent:~default_lifetime:~provider:~filesystem:parent:~default_lifetime:~provider:~psr6:parent:~default_lifetime:~provider:~redis:parent:~default_lifetime:~provider:~local:parent:cache.adapter.filesystemdefault_lifetime:~provider:~shared:parent:cache.adapter.filesystemdefault_lifetime:~provider:~pools:validator:adapter:cache.adapter.localpublic:falsedefault_lifetime:~provider:~namespace:~clearer:cache.default_pools_clearerserializer:adapter:cache.adapter.localpublic:falsedefault_lifetime:~provider:~namespace:~clearer:cache.default_pools_clearerapp:adapter:cache.adapter.sharedpublic:falsedefault_lifetime:~provider:~namespace:~clearer:cache.default_pools_clearer

And every adapter could be overriden by using the keyparent or by using the same name as the parent adapter (if you redefine theredis adapter to use a different provider, it will override the parent definition).

This PR also removes thelocal andshared pool for a singleapp pool. This is done to avoid confusion for users between the local/shared adapters and the local/shared pools and because app cache will almost always be shared.

@tgalopintgalopin changed the title[WIP][Cache][FrameworkBundle] Add cache adapters in semantic configuration[RFC][Cache][FrameworkBundle] Add cache adapters in semantic configurationApr 23, 2016
</service>

<serviceid="cache.pool.local"parent="cache.adapter.local">
<serviceid="cache.pool.app"parent="cache.adapter.shared">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@javiereguiluz WDYT about this one? We'd like to provide a preconfigured cache pool for user's need, so that one can inject it without much configuration. Currently we have two of these (cache.pool.local andcache.pool.shared).
The proposal here is to removecache.pool.local and renamecache.pool.shared tocache.pool.app.
Which means we have to questions:

  • OK for removing the local pool and keep only the shared one?
  • is thecache.pool.app name OK or do we have a better idea (e.g. iscache.pool.user better)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

At first glance, maybe this should be calledcache.pool.default I don't like the.app suffix because all the pools are for the app and because theapp. convention is commonly used as a prefix for user's stuff.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

But the pool we're talking about is only for user's stuff :)

@nicolas-grekas
Copy link
Member

👍 with a few more tests, must be on 3.1 or will be much harder to change afterwards.

@nicolas-grekasnicolas-grekas changed the title[RFC][Cache][FrameworkBundle] Add cache adapters in semantic configuration[Cache][FrameworkBundle] Add cache adapters in semantic configurationApr 25, 2016
@nicolas-grekasnicolas-grekas changed the title[Cache][FrameworkBundle] Add cache adapters in semantic configuration[FrameworkBundle] Add cache adapters in semantic configurationApr 25, 2016
@xabbuh
Copy link
Member

We need to update the XML schema definition.

<argument /><!-- default lifetime-->
</service>

<serviceid="cache.adapter.shared"alias="cache.adapter.filesystem" />
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I put the adapters here to follow the reading order (as in the configuration, the extension, etc.)

@tgalopintgalopinforce-pushed thecache-config branch 3 times, most recently from00986d1 to959bf64CompareApril 27, 2016 19:08
@nicolas-grekas
Copy link
Member

Included in#18667
Thank you@tgalopin for working on this!

@tgalopintgalopin deleted the cache-config branchApril 28, 2016 19:26
fabpot added a commit that referenced this pull requestMay 4, 2016
…caches (tgalopin, nicolas-grekas)This PR was merged into the 3.1-dev branch.Discussion----------[FrameworkBundle] Semantic config for app/system/pool caches| Q             | A| ------------- | ---| Branch?       | 3.1| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#18625| License       | MIT| Doc PR        | -Commits-------a2a567d [FrameworkBundle] Simplify config for app/system/pool caches80a5508 [FrameworkBundle] Add cache adapters in semantic configuration
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@tgalopin@nicolas-grekas@xabbuh@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp