Caching on WAP Devices
WAP devices generally cache WML decks. This is to reduce the
time that is wasted in trying to reload a page that has been loaded
earlier. However, for dynamic content, this is not a good
feature - the user may be reading some stale information from
the cache.
There are two issues to consider when we talk about caching.
They are:
Ø Caching by proxy
servers
Ø Caching by WAP devices
Caching by Proxy Servers
Proxy servers help to reduce the time needed to fetch a document
from the origin server. In a network, a proxy server may be set up
to act as a halfway house between the Internet and the web clients
in the various departments. The proxy server will cache all
documents requested by the network, so that it may fulfill
subsequent requests for a document retrieved earlier. The trip to
the origin server is reduced to making a trip to the proxy server,
as the following diagram explains.

Proxy servers should not cache ASP documents, as this defeats
the purpose of using ASP in the first place. To turn off caching by
proxy servers, use the Response.CacheControl property:
<% Response.CacheControl="private" %>
If for any reason you wish to enable caching by the proxy
server, you can set the cache control property to public.
<% Response.CacheControl="public" %>
What about caching by a WAP gateway? The WAP Caching Model
specification states that a WAP gateway must faithfully
implement the role of an HTTP/1.1 proxy with respect to caching and
cache header transmission.
Caching by WAP Devices
Just as a proxy server caches pages, WAP devices generally come
with some memory to act as a cache. Remember that bandwidth is
still a limitation for current WAP devices, so caching WML pages
can generally led to improved performance.
While a cache memory helps to load a page that has been loaded
previously without making a connection to the origin server, it is
a nuisance where time-sensitive pages are concerned. Pages like
stock information, weather reports, and online ticketing systems
are highly time-sensitive.
By default, WML pages are cached. To force a WML deck to expire
immediately after it has been received, I use the Response.Expires
property:
Expires.asp
<%
Response.ContentType = "text/vnd.wap.wml"
Response.Expires = -1
%>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="NoCache">
<p>
<% =now()
%>
</p>
</card>
</wml>
A <meta> element can provide meta-information for a WML
deck. Consider the following example:
Meta.asp
<% Response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head>
<meta
http-equiv="Cache-Control"
content="max-age=0"
forua="true" />
</head>
<card id="card1" title="NoCache">
<p>
<% =now()
%>
</p>
</card>
</wml>
The Cache-Control<meta> element allows you to set the
caching characteristics of the target WAP device. The content
attribute can contain the following values:
Ø
max-age=time_in_seconds
Ø must-revalidate
Ø no-cache
When the value of content is set to "max-age=0", it expires
immediately after it has been loaded. It is equivalent to
"no-cache".
We have looked at the two methods for controlling caching on WAP
devices, but which is better? In general, controlling the HTTP
headers is a better option than using the <meta> element.
This is because some WAP gateways may not pass caching-related
headers to the WAP device, especially the <meta> elements.
Also, <meta> elements are not supported by all WAP
devices.