You can create a database cache when you want to store data in the Livelink database temporarily. For example, if a Livelink user specifies values that you want to reuse, you can create a cache in which to hold them. The cache that you create is a persistent cache, meaning that it can store data between Livelink sessions. However, caches normally have specify a time-out interval, after which Livelink clears the cache values and frees the space.
You can cache a value only if the value can be converted to a String type and back using the Str.ValueToString() and Str.StringToValue() built-in methods. For example, you cannot cache a RecArray because it cannot be converted to a String type.
You use the $$LLIAPI:LLIApi Root:CacheUtil object's methods to handle cache. There are four basic methods to handle the cache:
- New()
- load()
- update()
- delete()
To create New Cache: you can use the following syntax:
$LLIAPI.CacheUtil.New( prgCtx, CacheAssoc, time )
prgCtx: User Program context ( required )
CacheAssoc: Value you want to store into cache ( required, but value can be blank or Undefined )
time: time-out interval, after which Livelink clears the cache values and frees the space. ( optional, default it takes from openText.ini > [general] section > CacheKeepMinutes = time- interval. )
It will return an assoc, containing ok=true ( if sucess ) and cacheID, which you can use for future references to the same cache.
To load cache Value: To load the cache you can use following syntax:
$LLIApi.CacheUtil.Load( prgCtx, CacheID )
To update Cache Value: To update the cache value, you can use following syntax:
$LLIAPI.CacheUtil.Update( prgCtx, CacheID, cacheAssoc )
To delete cache: Using following syntax, you can delete cache and free the resources:
$LLIAPI.CacheUtil.Delete( prgCtx, CacheID )

