varnish invalidate url REGEX from backend

Posted by ooouuiii on Stack Overflow See other posts from Stack Overflow or by ooouuiii
Published on 2014-08-22T22:17:52Z Indexed on 2014/08/22 22:20 UTC
Read the original article Hit count: 173

Filed under:
|
|

Say I have some highly-visited front-page, which displays number of some items by categories. When some item is added / deleted I need to invalidate this front-page/url and some 2 others.

What is the best practice how to invalidate those urls from backend in Varnish (4.x)?

From what I captured, I can:

  1. implement my HTTP PURGE handler in VCL configuration file, that "bans" urls matching received regex
  2. from backend to Varnish, send 3x HTTP PURGE requests for those 3 urls.

But is this approach safe for this automatic usage? Basicly I need to invalidate some views everytime some related entity is inserted/updated/deleted. Can it lead to ban list cumulation and increasing CPU consumption?

Is there any other approach? Thanks.

© Stack Overflow or respective owner

Related posts about regex

Related posts about varnish