UserPonderationStrategy

@Serializable
@SerialName(value = "userPonderation")
data class UserPonderationStrategy(val weight: Double = HALF) : FlippingStrategy(source)

A strategy that enables a feature for a consistent percentage of users.

Unlike PonderationStrategy, this strategy is deterministic per user - the same user will always get the same result. Users are bucketed based on their user ID hash.

Requires ContextKeys.USER_ID to be set in the FlippingExecutionContext. Throws IllegalStateException if no user ID is present.

See also

Throws

if ContextKeys.USER_ID is not present in the context

Constructors

Link copied to clipboard
constructor(weight: Double = HALF)
constructor(weight: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The percentage of users (0.0 to 1.0) for whom the feature is enabled.

Functions

Link copied to clipboard

Combines this strategy with other using logical AND.

Link copied to clipboard
open suspend override fun evaluate(featureId: String, store: FeatureStore?, context: FlippingExecutionContext): Boolean

Evaluates whether the feature should be enabled based on the execution context.

Link copied to clipboard

Negates this strategy.

Link copied to clipboard

Combines this strategy with other using logical OR.