Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

store-setnew! sets a parameter in the store only if the value differs from any previous value. Used if one wants to timeout on stagnant values.

Parameter Description
store The store name
id The key to which a value is stored
val The value to store
c Optional: Category, which the data belongs to, e.g. "vitalsign"

Example

Example 1: Create a store, set a value, check its timestamp, advance time and set it again with the same value. Then show that the timestamp hasn't changed.

> (define store (make-store "main"))
> (store-set! store "HR" 78)    
> (store-set! store "SpO2" 100)    
> (store-timestamp store "HR")
0.
> (store-timestamp store "SpO2")
0.
> (set! ##now (+ ##now 31.))  ;; This is a terrible hack to advance the clock on Console
> (store-setnew! store "HR" 78) 
> (store-set! store "SpO2" 100) 
> (store-timestamp store "HR")
0.
> (store-timestamp store "SpO2")
31.
Clone this wiki locally