Created
June 5, 2012 05:26
-
-
Save wokamoto/2872849 to your computer and use it in GitHub Desktop.
Nginx Cache Controller ver.1.1.2+ で、標準以外の URL キャッシュを削除する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('nginxchampuru_get_cache', 'nginxchampuru_get_cache', 10, 2); | |
function nginxchampuru_get_cache($key, $url = null) { | |
global $nginxchampuru; | |
if (!$url) { | |
$url = $nginxchampuru->get_the_url(); | |
} | |
$keys = array( | |
$key, | |
$nginxchampuru->get_cache_key($url.'@ktai'), | |
$nginxchampuru->get_cache_key($url.'@smartphone'), | |
$nginxchampuru->get_cache_key($url.'@smartphone.off'), | |
); | |
if ($key !== $nginxchampuru->get_cache_key($url)) { | |
$keys[] = $nginxchampuru->get_cache_key($url); | |
} | |
return $nginxchampuru->get_cache_file($keys); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment