Is there any way you can have 100% up-to-date data without doing the work to look it up? Not really. If there was, Oracle would be out of business. The closest you can get is the invalidation technique that I discussed above: every time anyone changes any of the data that you generate your responses from, you have to clear any cached responses that depend on that data. This is only possible in some situations.
I'd suggest you build it with no caching first, and then if it's slow you can look for where you'll get the most bang for your caching buck. You may find that your users will gladly trade a 5-minute delay on certain kinds of data for significantly better page response.
Also, think twice about putting all of that data into "session" objects. Unless it is specific to a single user, it doesn't belong in a session. Things like query results are not usually user-specific, i.e. a search for all stocks that have gone up in the 24 hours should be cached under "stocks, age < 24", not some session ID. In most systems users frequently repeat each other's queries, so caching results in a user-independent way gives better hit rates in the cache.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.