Lasso Soft Inc. > Home

[ cache ]


[cache] permits a chunk of content to be calculated once and stored and then fetched repeatedly. Each piece of cached content is given a name which is used when fetching. Cached content is given an expiration time, which is specified in minutes. Once the cache has expired, the content will be recalculated and the old data is replaced with the new.

[cache] accepts the following parameters which are all keywords:

-name - The name of the cached content. Each cached content item should have a unique name, as that is how they are differentiated.

-expires - The expiration time for the cached content, specified in the number of minutes after which the content is first calculated.

-condition - This is a boolean value which can be used to immediately expire and recalculate the content. Pass true for this value have the content recalculated.

-session - Cached content can be established on a per-user basis by associating the cache with a user session. The session should already have been established using the [session_start] method. The value passed for this parameter should be the name of the session.

  • Syntax
cache(-name, -expires=0, -condition=false, -session=null)
  • Intermediate

This example creates some simple cached content which is recalculated every 3 minutes.


cache(-name='my_cache', -expires=3)

'This was calculated at: '+date
'Note that the date will be refreshed every three minutes.'



This was calculated at 
Note that the date will be refreshed every three minutes.

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft