CACHE_V1 allows you to control over fetching data from datastore. It acts like a smart buffer where fetched data is stored allowing to specify an action that enables updating the content of the buffer.
CACHE_V1(path, trigger, stream)
- path - string specifying location and name of the cached data file in the resource tree. NB! The data file must have a “.sxt” extension.
- trigger - a query statement producing a stream of data. The content of the cached data buffer is updated when the message digest of produced data stream differs from the previous execution.
- stream - output of LIST command specifying source data.
At first run, when the cached data file does not exist, all specified source data is fetched.
Example: Speed up query processing by updating cached data when 10 seconds have passed since the last query:
1 2 3 4 5 6 7
@list = LIST('s3s://spectx-docs/logs/auth/$yyyy$/$MM$$dd$.srv*.*.log'); // produce stream which changes after 10 seconds since last run // by truncating selected time value to 10 seconds @trigger_10sec = dual | select(t[10 sec]); CACHE_V1(path:'/user/cached.sxt', trigger:@trigger_10sec, stream:@list);