1

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...?

1
  • 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. Aug 26 '14 at 20:56
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.

4
  • prepareCacheId has the short version and in it's simplest form it's a prefix + an md5 hash of the REQUEST_URI.
    – user4351
    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). 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.
    – user4351
    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! Aug 27 '14 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.