繁体   English   中英

跨域使Symfony2 HttpCache无效

[英]Invalidate Symfony2 HttpCache across domains

多个域指向同一个Symfony2 REST API后端:

  • example.com/api/post/abc
  • embed.example.com/api/post/abc
  • whitelabeled.com/api/post/abc

目标是在使用Symfony HttpCache时对所有域具有相同的响应。 最初的GET请求是正确的。

但是,当我将PUT请求发送到example.com/api/post/abc ,Symfony会自动使此路由对于example.com域无效。 但这不会使其他域的路由无效。 现在当我执行GET请求时,我留下了:

  • example.com/api/post/abc包含最新数据的响应
  • embed.example.com/api/post/abc旧的缓存响应
  • whitelabeled.com/api/post/abc旧的缓存响应

对于特定路由,如何在所有现有域之间自动使响应无效?

我想您可以尝试使用FOSHttpCacheBundle http://foshttpcachebundle.readthedocs.org/en/latest/features/invalidation.html并通过其在PUT控制器操作处的服务来使缓存无效

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM