query_cache_size query_cache_type query_cache_limit

MySQL version 4.0.1 and later has a query cache that stores the identical SELECT queries issued by clients. It also stores the query's result set in the query cache, which can significantly reduce the overhead of creating complex result sets for queries from the disk or memory caches, reducing both physical and logical I/O.

The query_cache_size parameter is used to allocate an amount of memory to cache the frequently executed queries and return the result set back to the client. Check the qcache_inserts, qcache_hits, and qcache_free_memory during runtime.
qcache_inserts shows the number of queries added to the query cache.
qcache_hits shows the number of query results taken from the query cache without real query execution.
qcache_free_memory shows the free available memory for query cache not being used.

An other important variable is Qcache_lowmem_prunes: each time MySQL need to reclaim memory space for a newer query, this value will be incremented. If your Qcache_lowmem_prunes is equal to zero you might be able to reduce your query_cache_size. If it's above 0 then you should probably increase query_cache_size. Also if you see a high value for qcache_hits compared to your total queries at runtime or a low value for qcache_free_memory, you probably need to increase the value of the query_cache_size parameter. To completely turn off the query cache (for some debugging?) set query_cache_type as 0, together with setting query_cache_size as 0. The query_cache_type parameter is used to enable or disable query cache in different ways.
A value of 0 or OFF prevents caching or retrieval of cached results.
A value of 1 (Default) or ON allows caching except of those statements that begin with SELECT SQL_NO_CACHE.
A value of 2 or DEMAND causes caching of only those statements that begin with SELECT SQL_CACHE.

The query_cache_limit (default 1MB) parameter sets the maximum result sets size stored in the query cache. A low ratio of qcache_hits to qcache_insert at runtime may also be caused by too low of a setting for query_cache_limit. In this case, you will need to increase the value of the query_cache_limit parameter to store the larger query result sets in the query cache.

Also the Qcache_free_memory counter provides insight into the cache's free memory. Low amounts observed vs. total allocated for the cache may indicate an undersized cache, which can be remedied by increasing query_cache_size.
 


My Values:
query_cache_size: 128M (was 64MB)
query_cache_limit 1M(default): 4M
I might try to increase query_cache_limit to 6MB, since my qcache_hits to qcache_insert ratio is about 2 and I still have lots of free cache (i.e. Qcache_free_memory). Do I have large queries that are not being cached? I could also be experiencing fragmentation of the query memory space because my query_cache_limit is too high (No since plenty of free cache space). 4MB seems like a lot of data for web pages.
Update: I will not increase the query_cache_size since Qcache_total_blocks is 27000 (27MB) and Qcache_free_memory 100MB. Maybe 2 is a good ratio (hits/inserts).