From bd8f3faacc082eb865bc706094439a0a26669d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Sat, 20 Sep 2014 15:15:25 +0300 Subject: [PATCH] add Minify::getCache() and Minify_Cache_Abstract that all cache classes must implement --- min/lib/Minify.php | 12 ++++- min/lib/Minify/Cache/APC.php | 2 +- min/lib/Minify/Cache/Abstract.php | 63 +++++++++++++++++++++++++++ min/lib/Minify/Cache/File.php | 2 +- min/lib/Minify/Cache/Memcache.php | 2 +- min/lib/Minify/Cache/WinCache.php | 3 +- min/lib/Minify/Cache/XCache.php | 2 +- min/lib/Minify/Cache/ZendPlatform.php | 2 +- 8 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 min/lib/Minify/Cache/Abstract.php diff --git a/min/lib/Minify.php b/min/lib/Minify.php index 38d42d6..aa22076 100644 --- a/min/lib/Minify.php +++ b/min/lib/Minify.php @@ -85,6 +85,16 @@ class Minify { self::$_cache = $cache; } } + + /** + * Get Minify cache + * + * @return Minify_Cache_Abstract|null + */ + public static function getCache() + { + return self::$_cache; + } /** * Serve a request for a minified file. @@ -396,7 +406,7 @@ class Minify { /** * Any Minify_Cache_* object or null (i.e. no server cache is used) * - * @var Minify_Cache_File + * @var Minify_Cache_Abstract */ private static $_cache = null; diff --git a/min/lib/Minify/Cache/APC.php b/min/lib/Minify/Cache/APC.php index 24ab046..053b70d 100644 --- a/min/lib/Minify/Cache/APC.php +++ b/min/lib/Minify/Cache/APC.php @@ -14,7 +14,7 @@ * @package Minify * @author Chris Edwards **/ -class Minify_Cache_APC { +class Minify_Cache_APC extends Minify_Cache_Abstract { /** * Create a Minify_Cache_APC object, to be passed to diff --git a/min/lib/Minify/Cache/Abstract.php b/min/lib/Minify/Cache/Abstract.php new file mode 100644 index 0000000..e68e964 --- /dev/null +++ b/min/lib/Minify/Cache/Abstract.php @@ -0,0 +1,63 @@ + **/ -class Minify_Cache_Memcache { +class Minify_Cache_Memcache extends Minify_Cache_Abstract { /** * Create a Minify_Cache_Memcache object, to be passed to diff --git a/min/lib/Minify/Cache/WinCache.php b/min/lib/Minify/Cache/WinCache.php index 500bdd8..ef5b106 100644 --- a/min/lib/Minify/Cache/WinCache.php +++ b/min/lib/Minify/Cache/WinCache.php @@ -14,8 +14,7 @@ * @package Minify * @author Matthias Fax **/ -class Minify_Cache_WinCache -{ +class Minify_Cache_WinCache extends Minify_Cache_Abstract { /** * Create a Minify_Cache_Wincache object, to be passed to diff --git a/min/lib/Minify/Cache/XCache.php b/min/lib/Minify/Cache/XCache.php index 3039ded..7c100b3 100644 --- a/min/lib/Minify/Cache/XCache.php +++ b/min/lib/Minify/Cache/XCache.php @@ -17,7 +17,7 @@ * @package Minify * @author Elan Ruusamäe **/ -class Minify_Cache_XCache { +class Minify_Cache_XCache extends Minify_Cache_Abstract { /** * Create a Minify_Cache_XCache object, to be passed to diff --git a/min/lib/Minify/Cache/ZendPlatform.php b/min/lib/Minify/Cache/ZendPlatform.php index 3130d69..ab57a04 100644 --- a/min/lib/Minify/Cache/ZendPlatform.php +++ b/min/lib/Minify/Cache/ZendPlatform.php @@ -17,7 +17,7 @@ * @package Minify * @author Patrick van Dissel */ -class Minify_Cache_ZendPlatform { +class Minify_Cache_ZendPlatform extends Minify_Cache_Abstract { /**