Skip to content

Support controllers as invalidation targets #233

Open
@benr77

Description

@benr77

When using the YML configuration to define invalidation, you can specify a list of routes to invalidate the cache for when a particular "match" is made.

However, I'm caching a ESI controller, and it would make sense to invalidate this controller's cache but it doesn't have a route of its own. Can the "routes" support controller names perhaps? Or add an additional option alongside routes called "controllers" which contains an array of controllers to invalidate - e.g. the bottom 4 lines of this

fos_http_cache:
  cache_control:
    defaults:
      overwrite: true
    rules:
      -
        match:
          attributes:
            _controller: "AcmeBlog:Post:loadPosts"

  invalidation:
    rules:
      -
        match:
          attributes:                        # When hitting these routes
            _route: "comments_update"
        routes:                               # Invalidate cache for the following routes
          comments_index
          comment_show
        controllers:                         # Invalidate cache for the following controllers
          "AcmeBlog:Post:loadPosts"

Is this the right approach? Any suggestions appreciated.

Thanks

Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions