I had a look through Enterprise_PageCache_Model_Processor::extractContent() to see how it determines the cache key for each page that it caches, but it's pretty complicated and there doesn't seem to be a simple way to determine the cache key for a given URL in order to remove it from the cache...?
Asked
Active
Viewed 1,393 times
1
kalenjordan
- 3,545
- 4
- 28
- 59
-
Okay I realized now why I couldn't find this anywhere - it's not the right way to go about it. What you're supposed to do is clear by tag not by URL. – kalenjordan Aug 26 '14 at 20:56
1 Answers
4
My guess (you didn't state the reason or use case for clearing a specific URL) would be to try to approach it by clearing the cache by tags. You could register an event at some point before the script terminates and call Mage::getSingleton('enterprise_pagecache/processor')->addRequestTag().
As you stated, the cache ID logic includes request and application environment information. You could poke around the Enterprise_PageCache_Model_Processor::_createRequestIds and Enterprise_PageCache_Model_Processor::_getFullPageUrl methods for more details on how they work.
beeplogic
- 1,952
- 9
- 16
-
prepareCacheIdhas the short version and in it's simplest form it's a prefix + an md5 hash of the REQUEST_URI. – Aug 26 '14 at 21:33 -
@Melvyn actually this is the problem - it's not simple at all :( I initially went this route and it worked in local environment but in production there were other things being appended to the cache key (cookies, store codes, all sorts of stuff). – kalenjordan Aug 27 '14 at 17:31
-
@kalenjordan it depends on the use case (and I'm interested in the use case to flush by URL), you could have intercepted in the method that mangles the REQUEST_URI into an ID, so that you still have access to the pure URL. On my mobile so don't have code available. Normally, flushing a URL is not a good approach as URLs get stale based on other factors and more often then not affects more than one URL. – Aug 27 '14 at 17:48
-
CMS Page URL :) Also realized I misread your initial comment - you said "in it's simplest form" I read that as "is simple". :) Sorry! – kalenjordan Aug 27 '14 at 18:44