Tech Tip: Setting or getting cache flush time programmatically
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: January 9, 2017
Adjusting the flush cache time was typically done in Database Settings/Memory page as shown below:
In v16, this setting can be manipulated programmatically. The following method below can set and get the cache flush time interval:
//-------------------------------------------------------------------------------- // Name: SET_GET_CACHE_FLUSH_TIME // Description: Method will set or get the flush cache time. Setting is done in // seconds. Setting the value will not reflect in the Database // Settings memory page as it is not stored. Getting flush cache // time is also in seconds. // Input: // $1 (LONGINT) - Cache flush time in seconds. // Output: // $0 (LONGINT) - Value greater than 0 is the flush time. 0 indicates input time. //-------------------------------------------------------------------------------- C_LONGINT($1;$timeInput) C_LONGINT($0) If (Count parameters=1) $timeInput:=$1 SET DATABASE PARAMETER(Cache flush periodicity;$timeInput) $0:=0 Else $0:=Get database parameter(Cache flush periodicity) End if |
Note: Changing the cache flush value at run time will not reflect on the Database Settings memory page.
Here is an example of setting the cache flush time:
C_LONGINT($time;$returnValue) $time:=30 $returnValue:=SET_GET_CACHE_FLUSH_TIME($time) // $returnValue = 0 |
Here is an example of getting the cache flush time:
C_LONGINT($returnTime) $returnTime:=SET_GET_CACHE_FLUSH_TIME // $returnTime = 30 |
See Also: