Open sandboxFocus

Method OnceEveryXSeconds

OnceEveryXSeconds(double, string)

Returns true if the method has not returned true for the same key for a period of time.

Declaration
public static bool OnceEveryXSeconds(double seconds, string key)
Parameters
Type Name Description
double seconds

An amount of time in seconds.

string key

An arbitrary key. Required but can be empty.

Returns
Type Description
bool
Remarks

Note that the side effect of calling this method, in case it returns true, is to set a timestamp for the specified key so that the next call to the method with the same value of key will return false unless it is called later than after the given time span. This is a side effect of calling this method and is not dependent of the actual result of the sampling expression. That is, the side effect will occur even in a combined expression like OnceEveryXSeconds( 1, "foo") && false.

This function is only available in the Sample expression.