/// <summary> /// Set a forced decision. /// </summary> /// <param name="context">The context object containing flag and rule key.</param> /// <param name="decision">OptimizelyForcedDecision object containing variation key.</param> /// <returns></returns> public bool SetForcedDecision(OptimizelyDecisionContext context, OptimizelyForcedDecision decision) { lock (mutex) { ForcedDecisionsStore[context] = decision; } return(true); }
/// <summary> /// Gets a forced variation /// </summary> /// <param name="context">The context object containing flag and rule key.</param> /// <returns>The variation key for a forced decision</returns> public OptimizelyForcedDecision GetForcedDecision(OptimizelyDecisionContext context) { if (context == null || !context.IsValid) { Logger.Log(LogLevel.WARN, "flagKey cannot be null"); return(null); } if (ForcedDecisionsStore.Count == 0) { return(null); } OptimizelyForcedDecision decision = null; lock (mutex) { decision = ForcedDecisionsStore[context]; } return(decision); }