Having read some on this subject:
http://stackoverflow.com/questions/37157/caching-mysql-queries
http://www.danga.com/memcached/
My SQL Caching problem: http://www.petefreitag.com/item/390.cfm
http://framework.zend.com/manual/en/zend.cache.html#zend.cache.introduction
I have a very unique (narrow) set of Queries and I think I could implement some caching quite easily within my current FastCGI C API executables (NOT PHP).
Zend describes their framework as: cache records are stored through backend adapters (File, Sqlite, Memcache...) through a flexible system of IDs and tags.
HOW is this implemented?
Since the same query can return different results if the Table has been changed, I need to monitor not only Queries, but UPDATE, INSERT and DELETE also (MySQL for now) Since this only happens from one of my processes, I could easily add a statement that deletes the cache when a table change is made.
Only SELECTs are permitted by the clients, in which case I could hash the queries and store them in a hash table or btree index along with a pointer to the file containing the results.
Is there a better way?