PostSharpAPI ReferencePost­Sharp.​Patterns.​Diagnostics.​Transactions.​ModelTransaction­Policy­Expression­FunctionsOnce­Every­XSeconds
Open sandboxFocus

TransactionPolicyExpressionFunctions.OnceEveryXSeconds Method

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
System.Double seconds

An amount of time in seconds.

System.String key

An arbitrary key. Required but can be empty.

Returns
Type Description
Boolean
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.