I dont know why my comment got cut half way, anyhow what I meant is: if we treat each query string as an identifier (and by md5 the query content we would have a rather unique identifier for each query), then we can store each query result in a unique file?
I think the most time consuming would serialization and un-serialization of the object returned by the query (to save/restore the result), Maybe we can use some easier method to store it?