eZ Community » Forums » eZ Publish 5 Platform » what the X-Location-Id in caching is...
expandshrink

what the X-Location-Id in caching is responsible for?

what the X-Location-Id in caching is responsible for?

Monday 22 February 2016 12:29:15 pm - 8 replies

Hi,

 

What's the responsibility/significance of 'X-Location-Id' in the following code. Anyone please provide a brief overview?

 

$response = new Response();

$response->headers->set( 'X-Location-Id', 123 );

$response->setSharedMaxAge( 3600 );

 

Thanks,

Rashidul

Modified on Monday 22 February 2016 12:32:32 pm by Rashidul Islam Rana

Monday 22 February 2016 12:49:52 pm

Hi

If the integration with reverse proxy is correctly configured then invalidation of caches can be done when content is updated in the backend. So if you edit a node/location in the backend eZ will invalidate related caches (for that page, for parent page, and possibly for some other) matching with X-Location-Id 

Monday 22 February 2016 12:58:55 pm

Quote from Ivo Lukač :

Hi

If the integration with reverse proxy is correctly configured then invalidation of caches can be done when content is updated in the backend. So if you edit a node/location in the backend eZ will invalidate related caches (for that page, for parent page, and possibly for some other) matching with X-Location-Id 

Hi Ivo,

Thank you very much for your answer.

For example I've a folder, Inside that folder(parent) I store all my menu items(child). So when render the menu bar, if i set the 'X-Location-Id' to that folder's(parent) location id, then whenever I update a menu item (child), will it invalidate the menu cache? What's the best way to implement caching in this scenario?

 

Can you suggest a possible use case of 'X-Location_Id'?

 

Thanks again,

Rashidul

Monday 22 February 2016 1:04:40 pm

Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :

Hi

If the integration with reverse proxy is correctly configured then invalidation of caches can be done when content is updated in the backend. So if you edit a node/location in the backend eZ will invalidate related caches (for that page, for parent page, and possibly for some other) matching with X-Location-Id 

Hi Ivo,

Thank you very much for your answer.

For example I've a folder, Inside that folder(parent) I store all my menu items(child). So when render the menu bar, if i set the 'X-Location-Id' to that folder's(parent) location id, then whenever I update a menu item (child), will it invalidate the menu cache? What's the best way to implement caching in this scenario?

Yes, it should work like that. What admin interface are you using? The old ez admin or ez platform ui ? 

Monday 22 February 2016 1:07:50 pm

Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :

Yes, it should work like that. What admin interface are you using? The old ez admin or ez platform ui ? 

Old one. Will it works?

Monday 22 February 2016 1:11:30 pm

Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :

Yes, it should work like that. What admin interface are you using? The old ez admin or ez platform ui ? 

Old one. Will it works?

Yes, if you have enabled viewcaching and if the reverseproxy (varnish) configuration is correctly done. 

Monday 22 February 2016 1:39:59 pm

Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :

Yes, it should work like that. What admin interface are you using? The old ez admin or ez platform ui ? 

Old one. Will it works?

Yes, if you have enabled viewcaching and if the reverseproxy (varnish) configuration is correctly done. 

Thanks very much, we are using viewcache with Varnish for more than a year. So it's no problem. Thank you for your help. So at the end, 'X-Location-Id' used for clearing cache based on location and it's smart enough to check other dependencies(child) as well related to that location when purging the cache, right?

Monday 22 February 2016 1:54:39 pm

Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :
Quote from Rashidul Islam Rana :
Quote from Ivo Lukač :

Yes, it should work like that. What admin interface are you using? The old ez admin or ez platform ui ? 

Old one. Will it works?

Yes, if you have enabled viewcaching and if the reverseproxy (varnish) configuration is correctly done. 

Thanks very much, we are using viewcache with Varnish for more than a year. So it's no problem. Thank you for your help. So at the end, 'X-Location-Id' used for clearing cache based on location and it's smart enough to check other dependencies(child) as well related to that location when purging the cache, right?

Weel, the smartness is not in the Varnish it self, it is in the view cache manager legacy code. IT was used before for clearing appropriate view caches on local disks. With eZ Publish 5 the code was just improved by adding that the reverse proxy for list of location ids gets invalidated. Hence, each cache in Varnish is tagged with X-location-id so it can be easily matched from the backend. 

So for example if you edit a folder under the root node with node/location id 78, the view cache manager will invalidate local view cache for location ids 78 and 2, and it will also do the same with Varnish by calling BAN request with X-Location-ids 78 or 2

Monday 22 February 2016 1:59:17 pm

we activated native view cache in the following way apart from the legacy view cache

ezpublish:    

     system:        

         my_siteaccess:            

              content:                

                   view_cache: true      # Activates HttpCache for content

 

Thanks for your help.

Modified on Monday 22 February 2016 2:00:55 pm by Rashidul Islam Rana

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from