Cache Job Results
Caching is a useful feature that reduces the server load and the response time of jobs. Caching the result of a job means that FlowForce Server prepares and stores the job result in some internal repository (i.e., the cache). If the job has parameters, the system creates a cache entry for every parameter combination. When the job with the cached result is called from another job (referred to as a consumer), FlowForce Server returns the cached result to the consumer (instead of executing the job again), which reduces the response time.
When you work with cached job results, note the following:
•It is mandatory to declare the return type of a job whose result is cached.
•The cached job and the consumer job must use the same credentials. If the credentials differ, the job executes as if no cache were defined.
•When you change the configuration of the cached job, the existing cache data is invalidated.
For examples, see Caching Job Results.
The screenshot below shows the Cashing Result section of the Configuration page. The available settings are listed below.
Select this check box if you want the job results to be cached. By doing so, you are instructing any consumers of the current job to read the cached result rather than execute the job. If the current job is executed directly (not through a consumer), FlowForce Server refreshes the cache. The job is executed directly when, for example, a defined trigger has fired or the job's Web service has been invoked. If the job parameters are not found in the cache, a new cached entry is created based on the supplied parameter combination.
When this option is enabled, any job that is calling the current job (i.e., the consumer job) will compute and populate the cache if it does not exist. Otherwise, only triggers and Web service calls will populate the cache.
This option restricts the number of cached job results per job. When the job has parameters, you might want to set this option to the number of all possible parameter combinations.
A cache consumer job is a Web service at the HTTP address you specify. The consumer Web service acts as a convenient way to retrieve and manage the cache of the job whose result is being cached. When invoked, the consumer job attempts to use the cached result of the main job in the first place. If there is no cached result and the Initiated by consumer option is disabled, the consumer retrieves the actual result returned by the main job. If there is no cached result and the Initiated by consumer option is enabled, the consumer retrieves the actual result returned by the main job and populates the cache.
The Refresh Cache timer (see below) controls how often the system should refresh the cache of the current job. All currently cached parameter combinations are refreshed.
The Purge Cache timer (see below) controls how often the system should purge the cache of the current job.
Click this button to refresh the cache manually. The button is located at the bottom of the Configuration page.
If you want to delete Refresh Cache and Purge Cache timers, click the button. The button (Duplicate) enables you to create a copy of the current trigger with the same settings.