Вопрос

i'm using the Liip Cache Control bundle to handle the caching in my project. By using this bundle you can configure the caching like this:

liip_cache_control:
    rules:
        - { path: /admin, controls: { private: true}, vary: [Accept-Encoding] }
        - { path: ^/_internal, controls: {private: true, max_age: 0}}
        - { path: ^/([^/]*)/live/time(.*), controls: { public: true, max_age: 1, s_maxage: 1    }, vary: [Accept-Encoding,Cookie] }

Now every esi (internal) route is not cached. But i now i want one internal request to be cached. Any idea how i can configure this? I cannot find which route is actually used to execute this request.

kind regards,

Daan

Это было полезно?

Решение

All ESI calls are handled via an _internal route (example from Using ESI in Symfony2):

# app/config/routing.yml
_internal:
    resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
    prefix:   /_internal

Documentation for LiipCacheControlBundle mentions how to generate internal routes:

When using ESI, [...] To generate the corresponding _internal route, inject the http_kernel into your controller and use HttpKernel::generateInternalUri with the parameters as in the twig render tag.

Have you tried adding appropriate rule to your liip_cache_control list? I suppose it should start with "/_internal" (try using generateInternalUri to see what's actually generated).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top