Last active
January 19, 2016 18:18
-
-
Save leonrenkema/6004aa0ff750bb7fea89 to your computer and use it in GitHub Desktop.
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 | |
abstract class CacheDriver { | |
private static $instance = NULL; | |
public static function getInstance() | |
{ | |
$classname = get_called_class(); | |
if (self::$instance != NULL) return self::$instance; | |
self::$instance = new $classname(); | |
return self::$instance; | |
} | |
} | |
class MemcachedDriver extends CacheDriver { | |
} | |
$cacheDriver = MemcachedDriver::getInstance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment