LassoScript Utility
Basics Browse Detail

[Cache] ... [/Cache]

Tag Link [Cache] ... Category Utility
Type Container Source Available Yes
Support Preferred Version 7.0
Change Updated Data Source Any
Output Type String Security Tag
Implementation LassoScript Sets Lasso 8.5, Lasso 8.0, Lasso 7.0


Container tag used for caching page data in Lasso's internal cache. Requires a -Name parameter which specifies the name of the cache, and several optional parameters may be used as shown in the following table.

Note that if a -Condition is specified then the -Expires parameter will be ignored.


[Cache: -Name='MyCache'] ... [/Cache]


Required Parameters
-Name Specifies the name of the cache. The name of the cache identifies the cached contents so it can be referenced on several pages. This is the only required parameter.
Optional Parameters
-Expires Specifies how many seconds the cached contents should last. If the cached contents is older than the time interval specified, then new content values will be cached on the next page load. The -Expires parameter will only be recognized if no -Condition parameter is specified.
-Condition Allows arbitrary refresh conditions to be specified. Accepts a boolean value of True or False and refreshes the contents immediately when True. Conditional expressions may be used to output the required True or False value. For example, -Condition=((Action_Param: 'Refresh') == 'Yes') refreshes the cache if the action param is equal to Yes. If a -Condition is specified then the -Expires parameter will be ignored.
-Session Specifies the name of a session that the cached content should be stored in. This allows the cached content to be user specific. If no -Session parameter is specified, then the content will be stored in a global variable instead.
-UseGlobal Can be used in concert with -Session to store cached data in both a global variable and a session. All caches are stored in a global variable by default if neither -Session or -UseGlobal is specified.

Change Notes

The -Key option was removed in Lasso 8.5.6.


To cache content with no expiration:

Use the [Cache] ... [/Cache] tags without the -Expires parameter. The example below shows a cached data source query that never expires. This means that the first result set out put by the contained [Inline] ... [/Inline] tags will be the results that are always output.

[Cache: -Name='Cache_Name']
[Inline: -Database='Contacts', -SQL='Select * from Contacts.People']
[Field:'First_Name'] [Field:'Last_Name'] - [Field:'Company']<br>