Re: [PHP-PEAR] Output_Cache Module
[email protected] (Björn Schotte)
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
* Ulf Wendel wrote:
> from the suggested Output_Cache and the Function_Cache Sebastian wrote.
> The Output_Cache sounds quite similar to what Björn Schotte introduced
> at his employer
Well, I introduced a banner caching system with
an URLCrawler (where I want to PEARify the
URLCrawler), but not a generic output cache :)
But we also use intensively output caches in
shared memory, with the old shm_* functions.
An output cache should have the following
features:
- store data in a data container (shared
memory, DB, ...)
- only store it if some conditions are
true (specific timestamp is reached,
caching data should be only valid for
X seconds etc.)
- ability to flush the cache explicitely
- retrieve the data from the container
- provide an easy API to store datas of
various types (no matter if it is an
object, integer, hash or something else)
- get the status of a data container ("valid",
"expired", "empty", ...)
- provide a mechanism to clearly identify
a data container, i.e. give it a unique
"label" for easy access. The API should
detect label conflicts, so for storing
the data it should use unique identifiers
(md5 or sth. like that) and "map" them to
the identifier that was given by the
software dev. who calls the API
- provide a "server" mechanism with ext/sockets
so that if you use shm for example, all the
data is stored on a specific server and the
API pulls the containers from this server which
is listening on a socket port. This avoids having
the same datas on each machine if you use clustered
web servers (currently, in our application we have
4 web frontends)
--
Björn Schotte [email protected]
http://rent-a-phpwizard.de/ [email protected]
Software dev advocate: http://www.advogato.org/person/baerli/