Re: Package proposal: a query cache plugin for mysqlnd

From: Date: Thu, 24 Jun 2010 11:54:05 +0000
Subject: Re: Package proposal: a query cache plugin for mysqlnd
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7300@lists.php.net to get a copy of this message
Stan schrieb:
This very interesting, as I was thinking about solution for transparent DB queries caching (but still in user control) as well, I definitely like low level solution like this. Just wanted to ask you whether there is a way to invalidate cached record on update or delete, or is it done automatically based on record key?
MySQL does not feature internal record ids. User defined storage handler can lift the TTL limitation. BUT this has to be done on a case-by-case basis. It is your job to develop a user defined storage handler for your specific application. User defined storage handler have to provide an is_select() function. The is_select() function gets called whenever a low level API call is made to run an unbuffered query. It will see all queries: deletes, inserts, updates and select. The function is expected to analyze the query and decide wheter its results shall be added to the cache or not. If your user defined is_select() detects an update or delete you can manually invalidate and flush those cache entries which are affected by the update or delete. MySQL won't help you with this task. It is up to you to detect dependencies and to proper invalidation. Ultimately I see this as something that you probably want to try and fiddle out in user space first before you even consider to move any such logic into C. I doubt its possible to find a solid and generic implementation. But you may try - in user space - the cache has the necessary features. Ulf

« previous php.pecl.dev (#7300) next »