You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like the ability to utilize database other not safely serializable resources in determining resource freshness in the config cache. Specifically for the routing cache.
I am attempting to use a database as a route resource. However to enable it to work with the routing components caching mechanism I need to be able to access my database from the resource.
Unfortunately you can't leave anything like that in state in the resource because it won't unserialize cleanly.
You can't inject anything into the resource after it is unserialized because you don't get an opportunity to work with the resource from the time that it is unserialized in ConfigCache to the time that isFresh() is called.
My initial thought was that if ConfigCache did a check to see if a given resource (after it is unserialized) supported the ContainerAware interface, then the config cache could inject the container for use by isFresh(). However that would result in some fairly large changes throughout the framework and I am not sure if a dependency between the Config component and the Dependency Injection component is appropriate. It would also make for some potentially confusing state issues with resource.
So I am honestly stymied as to an appropriate solution and I don't see a clear workaround that doesn't involve framework changes at some level.
The text was updated successfully, but these errors were encountered:
Using a database resource for your cached router means that you have to rebuild the cache each time your DB changes, which means you are forced to put the ConfigCache in debug mode in prod. This is a very bad idea for performance.
The proper way to load routes from the DB is to use the extended routing component build by the Symfony CMF project, which avoids breaking the caching for static routes.
I would like the ability to utilize database other not safely serializable resources in determining resource freshness in the config cache. Specifically for the routing cache.
I am attempting to use a database as a route resource. However to enable it to work with the routing components caching mechanism I need to be able to access my database from the resource.
Unfortunately you can't leave anything like that in state in the resource because it won't unserialize cleanly.
You can't inject anything into the resource after it is unserialized because you don't get an opportunity to work with the resource from the time that it is unserialized in ConfigCache to the time that isFresh() is called.
My initial thought was that if ConfigCache did a check to see if a given resource (after it is unserialized) supported the ContainerAware interface, then the config cache could inject the container for use by isFresh(). However that would result in some fairly large changes throughout the framework and I am not sure if a dependency between the Config component and the Dependency Injection component is appropriate. It would also make for some potentially confusing state issues with resource.
So I am honestly stymied as to an appropriate solution and I don't see a clear workaround that doesn't involve framework changes at some level.
The text was updated successfully, but these errors were encountered: