Re: Output_Cache Module
| From: | Ulf Wendel | Date: | Thu, 22 Feb 2001 13:18:39 +0000 |
| Subject: | Re: Output_Cache Module | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-1439@lists.php.net to get a copy of this message | ||
Björn Schotte wrote:
> An output cache should have the following
> features:
>
> - store data in a data container (shared
> memory, DB, ...)
Right and the design could be very much like the PHPLibs Session
implementation. One controler class that provides the user API and uses
a client/supplier class to do the storage. This way you get a generic
data / function call cache. It does not give you the output cache, but
calling ob_start() / ob_end() yourself is not that hard ;-).
class cache
public:
void cache(storage, preload, check_lifetime)
mixed cacheCall(function, class)
int cacheData(data, hash)
boolean flush([id])
boolean setLifetime([id])
...
[
private:
string generateID(hash)
]
class storage
public:
mixed get(id)
boolean save(id, data)
boolean delete(id)
boolean flush()
boolean isCached(id)
boolean isExpired(id)
[
private:
string load(id)
]
Source of a quick hack to sketch the API:
http://www.redsys.de/php/show_source.php?file=cache
Ulf