Skip to content

[Routing][Config] Ability to utilize database resources in router resources/config cache #5159

Closed
@mlively

Description

@mlively

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions