Created
March 23, 2016 14:57
-
-
Save dave1010/d4bba9cc98eded14c8e0 to your computer and use it in GitHub Desktop.
Cache buster
This file contains hidden or 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
interface CacheBuster | |
{ | |
/** | |
* @return string version | |
* @throws \NoVersionException | |
*/ | |
public function getVersion(); | |
} | |
class MultipleCacheBuster | |
{ | |
public function __construct($cacheBusers) | |
{ | |
$this->cacheBusers = $cacheBusers; | |
} | |
public function getVersion() | |
{ | |
// loop, with a catch | |
} | |
} | |
class WordPressCacheBusterBuilder | |
{ | |
public function __consruct($someEnvStuff) | |
{ | |
} | |
public function build() | |
{ | |
$busters = []; | |
if ($someEnvStuff) { | |
$busters[] = new GitTagCacheBuster(); | |
} | |
$busters[] = new ConstantValueCacheBuster(time()); // fallback | |
return new MultipleCacheBuster($busters); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment