Designer 10.7 | webMethods Service Development Help | Building Services | About Service Run-Time Parameters | About Service Caching | Types of Services to Cache
 
Types of Services to Cache
While caching service results can improve performance, not all services should be cached. You should never cache services if the cached results might be incorrect for subsequent invocations or if the service performs tasks that must be executed each time the service is invoked. Following are guidelines for you to consider when determining whether to cache the results for a service.
Services suited for caching:
*Services that require no state information. If a service does not depend on state information from an earlier transaction in the client’s session, you can cache its results.
*Services that retrieve data from data sources that are updated infrequently. Services whose sources are updated on a daily, weekly, or monthly basis are good candidates for caching.
*Services that are invoked frequently with the same set of inputs. If a service is frequently invoked by clients using the same input values, it is beneficial to cache the results.
Services that you should not cache:
*Services that perform required processing. Some services contain processing that must be processed each time a client invokes it. For example, if a service contains accounting logic to perform charge back and you cache the service results, the server does not execute the service, so the service does not perform charge back for the subsequent invocations of the service.
*Services that require state information. Do not cache services that require state information from an earlier transaction, particularly information that identifies the client that invoked it. For example, you do not want to cache a service that produced a price list for office equipment if the prices in the list vary depending on the client who initially connects to the data source.
*Services that retrieve information from frequently updated sources. If a service retrieves data from a data source that is updated frequently, the cached results can become outdated. Do not cache services that retrieve information from sources that are updated in real time or near real time, such as stock quote systems or transactional databases.
*Services that are invoked with unique inputs. If a service handles a large number of unique inputs and very few repeated requests, you will gain little by caching its results. You might even degrade server performance by quickly consuming large amounts of memory.