120
Chapter 2
I don’t think we don’t need to worry about caching in
the Break Neck app. If the phone number is different,
the request URL will be different. And if it’s the same
phone number, we don’t need fresh data from the
server; the customer’s address is the same each time.
You don’t always need to worry about caching.
In the Break Neck app, the request URL will be
unique for each phone number, so there won’t
be any caching problems there.
If a customer enters the same phone number,
caching probably would keep the request from
going to the Break Neck server... but in that
case, the server really would be returning the
same customer data—the customer’s address—
each time. So in that situation, caching actually
saves your customer’s time.
Be sure you don’t end up adding code that you
don’t need to your applications. In the Break
Neck app, there’s no need to make any changes
to the code you’ve already got.
Good thinking!
Man, Break Neck pizza rocks. There’s
nothing like a breakfast of cold pizza, a
whipped latte from Starbuzz, and the
Webville Times to read.
<script>
var request...
function foo()
{
...
}
</script>
JavaScript
<script>
var request...
function foo()
{
...
}
</script>
Customer’s Phone Number
Customer’s Address
Customer’s Order
caching and break neck pizza
This means we’re done with
Step 4! On to Step 5...