posted 19 years ago
Caching does not work that way.
Typically, you would store things in the cache indexed with a cache-key, which you can use later to look up the cache. So if the first user searches for a particular set of flights, you will need to construct a unique cache-key for that set of results and put them in the cache (this is the first time).
Whenever someone else comes along and performs a search, you construct a unique cache-key out of the search parameter values. Then you use that cache-key to try and hit the cache. If you hit in the cache, you retrieve results from the cache itself. If you miss in the cache, you retrieve results and put them in the cache, using the new cache-key.
Whenever someone adds a new flight thru the admin interface, you invalidate all cache-keys that have the specific city or the date-range, so that a cache miss happens the next time it is looked up.
This is a very generic description. This process has been extensively researched and optimized by caching product vendors. Like load-balancing, replication, distributed caching etc.
If you use a boxed product, you are good to go... if you are designing it in your architecture from scratch, you better be vary of all the pitfalls... read as much as you can abt the theoretical concepts behind it.
All the best.
Sun Certified Enterprise Architect