| Date tip published: | 01/17/2003 |
| Description: | Release 6 adds a new parameter, "ReCache", to the @DbColumn, @DbLookup, and @DbCommand functions. This new parameter causes the cache to get reloaded so new information can be looked up. |
To learn more about the many new enhancements to Release 6 and how to get re-certified as a Release 6 CLP use the following link:
Notes Domino 6 Application Development Update
New ReCache parameter for @DbColumn, @DbLookup and @DbCommand
In previous versions of Notes and Domino (release 5 and earlier) the results of a data lookup were cached. This caching greatly improved performance. Consider the following @DbColumn formula:
@DbColumn("";@DbName;"PartsView";1)
The first time this formula is executed the results of the lookup are stored in a cache. The next time the formula executes the results are returned from the cache and not from the actual "PartsView" view. This cached information is stored for the duration of the user's session (i.e. until they shut down Notes.) But, if new information (a new document) was added to the database or a document was changed then the results of the lookup would be stale (the new information would not be shown.)
One way to avoid a "stale cache" is to specify "NoCache" in the @DBColumn formula. This causes the lookup to never use the cached results. However, the performance benefits of caching are also never realized. An example of using NoCache is shown below:
@DbColumn("":"NoCache";@DbName;"PartsView";1)
Release 6 adds the new "ReCache" parameter. This will also cause the lookup to not use the cached results. However, unlike the NoCache parameter, the Recache option will cause the cache to get reloaded. Then subsequent lookups that do not use the ReCache or NoCache parameter will get the latest data. Below is the information from Domino 6 help on this parameter.
String argument. Optional. In the initial lookup, specify either "" or "NoCache." If the former case, subsequent lookups to the same data source, you can specify "ReCache."
"" (null string) caches the results of the lookup. Each subsequent lookup to the same location (within the same Domino session and so long as the database executing this lookup remains open) reuses that data until you specify "ReCache." Cached data improves performance and may be a good choice for stable data.
"ReCache" refreshes the cache with the latest data from the database. If you want to ensure that this lookup gets the latest information, specify this option.
"NoCache" gets the results of the lookup from the database; no cache is used. If you want to ensure that Domino retrieves the latest information for every lookup, specify this option.
Example Usage
One example of using ReCache might be to refresh the cache when a new keyword is added. Suppose a database has a form called "Parts" containing information on Parts. Other forms use the @DbColumn function to retrieve the parts and display them using the dialog list field type.
To ensure that the users always see the current list of parts add the following formula to the PostSave event of the Parts form.
temp:=@DbColumn("":"ReCache";@DbName;"PartsView";1);
@True
Now, when a part is added or updated by that user the cache will be refreshed when the Parts form is saved. Note that parts added by other users will not cause the cache on that user's computer to be updated. Another option to get around this is to have a button or some other means to execute a @DbColumn with the ReCache parameter to update the cache. Don't use the "ReCache" parameter in all your formulas, that is the same as using "NoCache" since data lookups will then never use the cached data.
|