From 4836698b4199bcc9bba97a41ab5bd1c4c07977e8 Mon Sep 17 00:00:00 2001 From: Calum Brodie Date: Wed, 13 Aug 2014 10:53:55 +0100 Subject: [PATCH 1/2] Add example of passing header to Cache Invalidator --- doc/cache-invalidator.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/cache-invalidator.rst b/doc/cache-invalidator.rst index e4e83d14..b74a6a19 100644 --- a/doc/cache-invalidator.rst +++ b/doc/cache-invalidator.rst @@ -43,6 +43,13 @@ See below for the :ref:`flush() ` method. Invalidate a URL:: $cacheInvalidator->invalidatePath('http://www.example.com/users')->flush(); + +Invalidate a URL with added header(s):: + + $cacheInvalidator->invalidatePath( + 'http://www.example.com/users', + array('Cookie' => 'foo=bar; fizz=bang') + )->flush(); Refreshing Paths and URLs ------------------------- @@ -60,6 +67,21 @@ Refresh a URL:: $cacheInvalidator->refreshPath('http://www.example.com/users')->flush(); +Refresh a URL with added header(s):: + + $cacheInvalidator->refreshPath( + 'http://www.example.com/users', + array('Cookie' => 'foo=bar; fizz=bang') + )->flush(); + +Optionally adding headers with invalidation request +------------------------------------------------------- + +.. note:: + If adding the same headers on every invalidation request it would be preferrable + to apply these headers automatically rather than passing them explictly each time. + You can use a custom guzzle client to achieve this. See `Custom Guzzle Client` under :doc:`proxy clients `. + .. _invalidate regex: Invalidating With a Regular Expression From f1749c782362c7748c48e217e5c2122739d53501 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Thu, 14 Aug 2014 08:40:52 +0200 Subject: [PATCH 2/2] Move custom header to include --- doc/cache-invalidator.rst | 10 +++------- doc/includes/custom-headers.rst | 3 +++ doc/proxy-clients.rst | 4 +--- 3 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 doc/includes/custom-headers.rst diff --git a/doc/cache-invalidator.rst b/doc/cache-invalidator.rst index b74a6a19..aa3763d5 100644 --- a/doc/cache-invalidator.rst +++ b/doc/cache-invalidator.rst @@ -51,6 +51,8 @@ Invalidate a URL with added header(s):: array('Cookie' => 'foo=bar; fizz=bang') )->flush(); +.. include:: includes/custom-headers.rst + Refreshing Paths and URLs ------------------------- @@ -74,13 +76,7 @@ Refresh a URL with added header(s):: array('Cookie' => 'foo=bar; fizz=bang') )->flush(); -Optionally adding headers with invalidation request -------------------------------------------------------- - -.. note:: - If adding the same headers on every invalidation request it would be preferrable - to apply these headers automatically rather than passing them explictly each time. - You can use a custom guzzle client to achieve this. See `Custom Guzzle Client` under :doc:`proxy clients `. +.. include:: includes/custom-headers.rst .. _invalidate regex: diff --git a/doc/includes/custom-headers.rst b/doc/includes/custom-headers.rst new file mode 100644 index 00000000..bfd31bb6 --- /dev/null +++ b/doc/includes/custom-headers.rst @@ -0,0 +1,3 @@ +This allows you to pass headers that are different between purge requests. +If you want to add a header to all purge requests, such as ``Authorization``, +use a :ref:`custom Guzzle client ` instead. diff --git a/doc/proxy-clients.rst b/doc/proxy-clients.rst index b1ec47bd..f05ee39c 100644 --- a/doc/proxy-clients.rst +++ b/doc/proxy-clients.rst @@ -114,9 +114,7 @@ For instance:: Please note that purge will invalidate all variants, so you do not have to send any headers that you vary on, such as ``Accept``. -The above allows you to pass headers that are different between purge requests. -If you want to send headers for all purge requests, such as ``Authorization``, -use a :ref:`custom Guzzle client ` instead. +.. include:: includes/custom-headers.rst Refresh ~~~~~~~