Re[2]: [PEAR-DEV] Package proposal
| From: | Maxim Antipin | Date: | Mon, 11 Oct 2004 08:30:01 +0000 |
| Subject: | Re[2]: [PEAR-DEV] Package proposal | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-33760@lists.php.net to get a copy of this message | ||
Hello Ian,
Sunday, October 10, 2004, 3:52:26 PM, you wrote:
I am newbie here, but as I understand after reading
http://pear.php.net/manual/en/guide-developers.php,
I can take part in
discussion of proposal.
IE> Not to disparage your contribution, but I think there is a better solution.
IE> You could create a 'cmysql' DB driver, which extends DB_mysql and implements
IE> caching. This should have minimal impact on a project already using DB, as
IE> you would only have to change the DSN and add calls in to control the
IE> caching.
Well, i want to say that I described just what we currently have. I do
not insist that current form should be preserved in future.
As for your idea to make 'cmysql' DB driver - it is a deal of several
hour and can be easily implemented. Moreover it is possible
theoretically to create wrapper for any DB driver. Wrapper will
encapsulate driver instance as its instance variable and will
redirect all method calls to driver. For 'get' and 'execute' methods it
will handle caching procedures to addition to common method call
redirect.
IE> You could also use PEAR's Cache package to store the results. You'd get the
IE> benefit of DB's API, and you wouldn't have to write the cache code yourself.
When I briefly looked through description of 'Cache' package
mistakenly decided that it is intended to cache script output not
data. Now i see that i implemented same thing (invented bicycle :))
IE> I think you could probably pull something workable together in a couple
IE> hundred lines of code.
Actually caching itself is really couple hundreds lines of code. But
main benefits is certain query caching and automatic cache validation.
This allows just forget that we actually use queries cache and just
create code as for native 'DB'.
--
Best regards,
Maxim Antipin (ITScript CEO) mailto:max@itscript.com