News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHP: Client side caching for all MySQL extensions

Note: This article was originally published at Planet PHP on 24 June 2010.
Planet PHP

The first public mysqlnd plugin adds client side query result caching to all MySQL extensions of PHP (ext/mysql, ext/mysqli, PDO_MySQL). The cache is written in C. It does not change any of the PHP MySQL APIs and works with any PHP application using MySQL. Query results are stored on the client. Cached data can be stored in main memory, APC, Memcache, SQLite (theoretically - via SQLite wrapper - BerkeleyDB). The default invalidation strategy is TTL (Time to live): cache entries are valid for n-seconds. The TTL can be set per query or globally for all queries. User-defined storage handler can implement any invalidation method. Some built-in storage handler offer a special slam defense mode which you may know from Memcache or APC. Statistics help you to identify cache candidates and to measure cache efficiency. The plugin is available in source (PHP License)

Built-in query caching for all PHP MySQL extensions/APIs

View more presentations on the MySQL native driver for PHP (mysqlnd) and its C plugin API.

Download :

C performance, almost transparent, horizontal scale out

The mysqlnd query result plugin is written in C like every other mysqlnd plugin today. It plugs into the MySQL native driver for PHP (mysqlnd) and adds query caching functionality to it. C gives you the best possible performance - better than any PHP based cache. The plugin is also a PHP extension. Adding a new PHP extension to an existing PHP deployment infrastructure should be easy going technically. Because it is a PHP extension and part of the database library, it gives many users, who do not compile PHP themselves, an "out-of-the box" experience. For those users caching will be just "built-in".

If you are new to mysqlnd and mysqlnd plugins, please note the background information given at the end of the article.

Any PHP MySQL application | ext/mysql, ext/mysqli, PDO_MySQL | MySQL native driver for PHP (mysqlnd) mysqlnd query result cache plugin Hit A Miss Cache:
main memory, Memcached, APC, SQLite

Truncated by Planet PHP, read more at the original (another 25039 bytes)