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

[Config][FrameworkBundle/Translation][Router] Interchangeable ConfigCache#5912

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
bnw wants to merge9 commits intosymfony:masterfromwebfactory:replaceable-configCache3
Closed

[Config][FrameworkBundle/Translation][Router] Interchangeable ConfigCache#5912

bnw wants to merge9 commits intosymfony:masterfromwebfactory:replaceable-configCache3

Conversation

bnw
Copy link

@bnwbnw commentedNov 5, 2012

We would like to use a custom implementation of ConfigCache to employ a modified caching strategy. Basically, it is about special kinds of resources that might change on runtime also during production (will post more details if anyone is interested).

Currently the ConfigCache implementation is not exchangeable, which this what this PR addresses. I have tried to keep BC as far as possible. If that is not a hard requirement, I could also come up with different implementations.

Alternatively, a factory method for the ConfigCache in client classes could do.

Additionally, the kernel uses ConfigCache for the service container itself. We did not touch that part because there is probably no useful way to configure or inject alternative implementations before the container itself is available.

QA
Bug fix?no
New feature?yes (refactoring and added flex point)
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PRnone

private function getConfigCacheFactory()
{
if (!$this->configCacheFactory) {
$this->configCacheFactory = new \Symfony\Component\Config\ConfigCacheFactory($this->options['debug']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add this as a use above and refer to the alias.

@mpdude
Copy link
Contributor

Made some fixes, let's wait for the next Travis build

@mpdude
Copy link
Contributor

The problem with tests is that now the service "translator.default" has a dependency on a non-existent service "config.config_cache_factory".

@@ -70,6 +71,9 @@
</argument>
<argument type="service" id="router.request_context" on-invalid="ignore" />
<argument type="service" id="logger" on-invalid="ignore" />
<call method="setConfigCacheFactory">
<argument type="service" id="config.config_cache_factory" />
Copy link
Member

Choose a reason for hiding this comment

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

wrong service id here

…ory altogether, as Router and Translator will still fall back to old behaviour (BC).
@mpdude
Copy link
Contributor

I removed all the new service definitions as all code will by default behave as before (creating default implementations).

Only clients that want to change the factory implementation need to inject the right (new) one and can do so in a compiler pass.

It is a common pattern for clients of ConfigCache/ConfigCacheFactory to check whether the cache is fresh and if not, fill it. This removes a little bit of repeated code.Additionally, it gives factory implementations more control over how the cache is written to (for example they can employ other file locking/atomic write strategies).
@mpdude
Copy link
Contributor

@fabpot Do you think this PR is a worthwhile improvement that has any chance of being merged at all?

Otherwise we'd need to find other ways to solve the problem in our projects.

@fabpot
Copy link
Member

Closing for the most recent work on this topic in#7230

@fabpotfabpot closed thisApr 20, 2013
@mpdudempdude deleted the replaceable-configCache3 branchSeptember 24, 2015 19:28
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@bnw@mpdude@fabpot@stof@sstok

[8]ページ先頭

©2009-2025 Movatter.jp