Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cache buster
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
You can’t perform that action at this time.