views:

37

answers:

2

I heard that a lot of big project administrators caches results. I wonder how do I do it? Thanks

I'm using PHP.

A: 

In a tipical mysql - php environment memcached can be a good choice.

memcached FAQ

csbg
A: 

Pseudo-logic:

Test if query result exists in cache
If so,
    retrieve from cache 
    return result
else   
    execute query against database   
    transfer results to an array, list or object(s) [dependent on language]
    store results in cache (serialize if necessary)
    return result

Often memcache or APC (if you're using PHP) can be used to store the cache, but files can be used at a pinch. Code will vary depending on what medium you're using for cacheing

Mark Baker