function resp_img_expire_cache_alter in Responsive images and styles 7
Support for purge/expire module. Specific for nginx / barracuda Clears the cache for anonymous users and for the current user Required changes to nginx config files nginx_speed_purge.conf change fastcgi_cache_purge speed $1$host$request_method$2$is_args$args; to fastcgi_cache_purge speed $1$host$2; nginx_advanced_include.conf change fastcgi_cache_key "$device$host$key_uri$cookie_OctopusCacheID"; to fastcgi_cache_key "$device$host$key_uri$cookie_OctopusCacheID$cookie_respimg";
File
- ./
resp_img.module, line 290
Code
function resp_img_expire_cache_alter(&$expire, $node, &$paths) {
if (variable_get('resp_img_purgeexpire', FALSE)) {
if (!is_array($expire)) {
return;
}
// make array unique
$expire = array_unique($expire);
// add a copy of each path for each defined suffix (using width)
$extra_paths = array();
$widths = resp_img_suffix_load_all_breakpoints();
foreach ($widths as $k => $v) {
foreach ($expire as $path) {
$extra_paths[] = $path . $v;
// if Cache cookie is set add a copy of each path for the current user
if (isset($_COOKIE['OctopusCacheID'])) {
$extra_paths[] = $path . $_COOKIE['OctopusCacheID'] . $v;
}
}
}
$expire = array_merge($expire, $extra_paths);
}
}