Name: Aoe_CacheRefresh
Owner: AOE
Description: null
Created: 2015-03-03 16:12:08.0
Updated: 2016-09-19 12:20:25.0
Pushed: 2015-08-10 21:30:09.0
Homepage: null
Size: 161
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Author: Fabrizio Branca
This module allows you the refresh caches while they not expired.
When “force refreshing” a page (e.g. via CTRL+F5) the browser sends additional headers to the servers:
This module allows you to configure a list of IP addresses that can bypass loading anything from the cache when these headers are being detected.
There are many use cases where this behavior comes in handy:
Add this to app/etc/local.xml
fig>
<global>
<aoe_cacherefresh>
<allowed_ips>INSERT COMMA-SEPARATED LIST OF IP ADDRESSES HERE</allowed_ips>
</aoe_cacherefresh>
</global>
nfig>
app/etc/local.xml
By default all cache loading will be bypassed if the PRAGMA
or the CACHE_CONTROL
headers are set to no_cache
. In addition to that you can
control which caches are being bypassed more finegrained by defining a blacklist or a whitelist regex pattern:
-H "PRAGMA: no-cache" -H "X-CACHEREFRESH-BLACKLIST: #.*(config|layout).*#i" -s -X GET -I http://www.example.com/examplepage
-H "PRAGMA: no-cache" -H "X-CACHEREFRESH-WHITELIST: #.*helloworld.*#i" -s -X GET -I http://www.example.com/examplepage
The whitelist and the blacklist pattern only work on cache keys, not cache tags. Since cache tags are not being used while loading content from the cache this is not possible.
If a whitelist and a blacklist are specified the the cache key has to match the whitelist pattern first and then also not match the blacklist pattern after that.
-H "PRAGMA: no-cache" -s -X GET -I http://www.example.com/examplepage
or indirectly (e.g. if the website is not accessible from outside at this point):
-H "Host: www.example.com" -H "PRAGMA: no-cache" -s -X GET -I http://127.0.0.1/examplepage
Find more advanced examples and code snippets in this (German) blog post
Example:
i in `n98-magerun.phar sys:url:list --add-all 1`; do curl -H "PRAGMA: no-cache" -s -X GET -I $i; done
Since Mage_Core_Model_Cache->load()
is being called very early in Magento's request lifecycle Mage::log()
can't be used to debug any ids, ips, whitelists or blacklists.
If you want to use the buildt-in (disabled by default) simple logging to a file temporarily set Aoe_CacheRefresh_Model_Cache->cacheRefreshDebug = true
.