Client-Side Caching
For Web service calls that repeatedly request the same, static information (for example, post codes), the RIA framework has a built-in cache to store the information. Response times for the client application can be reduced by eliminating unnecessary traffic across the Web. You can set the following options in the config object for the cache.
-
cache: true
This setting causes the result of the Web service to be stored in the cache. Further calls to the same service that also have cache: true perform a simple cache lookup rather than invoke the Web service.
-
cacheExpiry: number-of-seconds
This setting specifies the number of seconds the entry remains in cache before it expires. When an entry expires, the next call to the Web service method invokes the Web service rather than using the cached value.
-
cacheKey: String
This setting is an optional secondary key for a Web service method.
The primary key is the method name, so that multiple calls to the same method use the same cached value. For a method with parameters, you would almost certainly not want to use the same cached value for all calls to that method. If a cacheKey value is specified, only an entry in the cache that matches the method and the cacheKey is considered to match the request.
Individual method calls with unusual parameters can bypass the cache, by not using the cache: true option.