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

[HttpKernel] use ConfigCacheFactory to create ConfigCache instances#14636

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
xabbuh wants to merge1 commit intosymfony:2.7fromxabbuh:config-cache-factory

Conversation

xabbuh
Copy link
Member

QA
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR
#14178 introduced a newConfigCacheFactory to createConfigCache instances. TheRouter and theTranslator class had been updated. However, theKernel class still created theConfigCache on its own.

@xabbuhxabbuhforce-pushed theconfig-cache-factory branch fromb57891f to8d5f992CompareMay 14, 2015 14:54
@fabpot
Copy link
Member

IIRC, it was consciously not changed in Kernel.

*
* @api
*/
public function __construct($environment, $debug)
public function __construct($environment, $debug, ConfigCacheFactoryInterface $configCacheFactory = null)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if we will accept this PR as I don't see the use case but in any case, this should be moved to a method instead of a constructor argument. I would even create a protected method like the getCacheDir() method, so configuration happen in the AppKernel class instead of whenever you need to create a Kernel instance (think tests for instance).

@xabbuh
Copy link
MemberAuthor

@fabpot Do you remember for what reason?

@xabbuhxabbuhforce-pushed theconfig-cache-factory branch from8d5f992 tof67f261CompareMay 14, 2015 15:21
@fabpot
Copy link
Member

@xabbuh I'm not sure but@mpdude might remember.

@mpdude
Copy link
Contributor

ConfigCacheFactory can be used for service based cache validation (doc PR still pending). That does not make sense for the container if you need the contained services to validate it... Or would it?

@xabbuh
Copy link
MemberAuthor

I found this in the PR description of#14178:

Component/HttpKernel/Kernel::initializeContainer still uses the ConfigCache implementation directly as there is no sensible way of getting/injecting a factory service (chicken-egg).

I don't think that this is true. For example, one might want to customise this steps by providing a customConfigCacheFactoryInterface implementation in theirAppKernel class.

@mpdude What do you think?

@mpdude
Copy link
Contributor

Well, technically it should work in a straightforward manner.

It's probably tedious to set up in the AppKernel when you don't have services or the DIC.

All real life use cases I've seen so far involved loading routes or translations from a database and I have no idea if that might make sense for the Kernel as well.

So, is this just a consistency thing or do you have a real use case where it would help? If so, do you want to change the way the container is cached or the way that cache is validated?

@fabpot
Copy link
Member

I would err on the side of not "fixing" this in the Kernel... except if someone does have a real world use case.

@xabbuh
Copy link
MemberAuthor

For now, this is more a consistency thing, which@aitboudad and I talked about, but I don't have a concrete use case in mind and AFAIK neither does he. So, of you think it's not wish to do this change just for the same if consistency, let's see if someone comes up with a real use case or close it otherwise.

@fabpot
Copy link
Member

I'm in favor of closing this. There is no point in providing an extension point if we don't have a use case.

@aitboudad
Copy link
Contributor

@fabpot what do you think about usingConfigCacheFactory here without providing an extension point, which is consistent and better than usingConfigCache directly ?

@aitboudad
Copy link
Contributor

Honestly I don't see any use case even fortranslations orroutes, the current implementation is mainly related to locale files and it's not possible to loading from a database for example.

@mpdude
Copy link
Contributor

@aitboudad See#14178 and the related PRs.

TheConfigCacheFactory does not directly provide the loading from (for example) a database. You'd have to write your own loaded for that.

The thing is that once your data has been pulled from the DB and is put intoConfigCache, you have no way of re-validating that cache and to check if the cached content is still in sync with the database. This is because all the cache validation happens inside theConfigCache class which was previously created inside theTranslator (for example). No way of getting any other validation logic in there, especially one that would need access to a DB. Being able to inject theConfigCacheFactory changed that.

@aitboudad
Copy link
Contributor

@mpdude thanks for the clarification :)
If I understand, the need here is to check the cache is still sync or not, so why not just using customResourceInterface.
If we talk aboutTranslator (for example) the consistant way is to use a custom loader (loading from database) and when data is loaded we can add then add Resource to theCatalogue to check data freshness from DB.

Anyway I think I missed something so I prefer to stay until this part is documented ^^

@mpdude
Copy link
Contributor

Yes, I know, writing the docs is on my list. A customResourceInterface implementation does not work, because the Resource is simply unserialized from the cache andisFresh() is called. No way to get a database connection in there.

Can we close this PR for the time being?

@fabpot
Copy link
Member

Closing now.

@fabpotfabpot closed thisMay 16, 2015
@xabbuhxabbuh deleted the config-cache-factory branchMay 16, 2015 12:25
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.

4 participants
@xabbuh@fabpot@mpdude@aitboudad

[8]ページ先頭

©2009-2025 Movatter.jp