mirror of
https://github.com/mrclay/minify.git
synced 2025-08-28 08:10:14 +02:00
add Minify::getCache() and Minify_Cache_Abstract that all cache classes must implement
This commit is contained in:
committed by
Steve Clay
parent
f29e1e6b06
commit
bd8f3faacc
@@ -86,6 +86,16 @@ class Minify {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
@@ -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
|
||||
|
63
min/lib/Minify/Cache/Abstract.php
Normal file
63
min/lib/Minify/Cache/Abstract.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Minify_Cache_Abstract
|
||||
*
|
||||
* @package Minify
|
||||
*/
|
||||
abstract class Minify_Cache_Abstract {
|
||||
/**
|
||||
* Write data to cache.
|
||||
*
|
||||
* @param string $id cache id (e.g. a filename)
|
||||
* @param string $data
|
||||
*
|
||||
* @return bool success
|
||||
*/
|
||||
public function store($id, $data)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of a cache entry
|
||||
*
|
||||
* @param string $id cache id (e.g. a filename)
|
||||
*
|
||||
* @return int size in bytes
|
||||
*/
|
||||
public function getSize($id)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a valid cache entry exist?
|
||||
*
|
||||
* @param string $id cache id (e.g. a filename)
|
||||
* @param int $srcMtime mtime of the original source file(s)
|
||||
*
|
||||
* @return bool exists
|
||||
*/
|
||||
public function isValid($id, $srcMtime)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the cached content to output
|
||||
*
|
||||
* @param string $id cache id (e.g. a filename)
|
||||
*/
|
||||
public function display($id)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the cached content
|
||||
*
|
||||
* @param string $id cache id (e.g. a filename)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
class Minify_Cache_File {
|
||||
class Minify_Cache_File extends Minify_Cache_Abstract {
|
||||
|
||||
public function __construct($path = '', $fileLocking = false)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* }
|
||||
* </code>
|
||||
**/
|
||||
class Minify_Cache_Memcache {
|
||||
class Minify_Cache_Memcache extends Minify_Cache_Abstract {
|
||||
|
||||
/**
|
||||
* Create a Minify_Cache_Memcache object, to be passed to
|
||||
|
@@ -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
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* @package Minify
|
||||
* @author Elan Ruusamäe <glen@delfi.ee>
|
||||
**/
|
||||
class Minify_Cache_XCache {
|
||||
class Minify_Cache_XCache extends Minify_Cache_Abstract {
|
||||
|
||||
/**
|
||||
* Create a Minify_Cache_XCache object, to be passed to
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* @package Minify
|
||||
* @author Patrick van Dissel
|
||||
*/
|
||||
class Minify_Cache_ZendPlatform {
|
||||
class Minify_Cache_ZendPlatform extends Minify_Cache_Abstract {
|
||||
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user