Understanding a flag freeze

2 minute read

Flag freeze

When a Flag value is frozen - the first time a flag is checked, the flag value will be frozen and kept for future evaluation. This will result in consistent behavior for the user. Any change, whether new configurations or local custom property values, will not have an effect until the flag gets unfrozen.

The flag freeze, unfreeze and freeze levels are only available on these client-side SDKs

  • iOS (Swift, Objective-c, tvOS…​)

  • Android

  • JavaScript (Browser, React Native, Tizen…​)

  • .net Client

Flag freeze level

  • none - no freeze at all, the flag value will be evaluated every time its value gets called.

  • untilForeground- the flag value is consistent from foreground to background.

  • untilLaunch - the flag value is consistent until next launch time.

The flag gets unfrozen in the following scenario:

  • Next application launch or page loading in a browser - when the app is launched, the flag value is checked by the app and the value gets calculated based on the last fetched configuration.

  • Next foreground event (only for mobile) - when the app goes into the foreground the SDK calls unfreeze. This behavior can be controlled by defining different freeze levels.

  • Unfreeze - when the unfreeze function gets called.

Flag freeze level default

  • SDKs version 4.x - set to untilForeground

  • SDKs version >= 5 - set to none

Flag unfreeze

The following are code examples of how to unfreeze a flag:

Swift
Objective-C
Android
React Native
JavaScript
.net Client
Rox.unfreeze();
[Rox unfreeze];
Rox.unfreeze();
Rox.unfreeze();
Rox.unfreeze();
Rox.Unfreeze();

To unfreeze all flags under a specific namespace:

Swift
Objective-C
Android
React Native
JavaScript
.net Client
ROXCore.unfreezeNamespace(namespace);
[ROXCore unfreezeNamespace:namespace];
Rox.unfreeze(namespace);
Rox.unfreeze(namespace);
Rox.unfreeze(namespace);
Rox.Unfreeze(namespace);

To unfreeze a specific flag:

Swift
Objective-C
Android
React Native
JavaScript
.net Client
flag.unfreeze();
[flag unfreeze];
flag.unfreeze();
flag.unfreeze();
flag.unfreeze();
flag.Unfreeze();

Set flag freeze level default

You can define flag freeze level on an app level by defining the default flag level using RoxOptions , options.defaultFreezeLevel , or when creating the flag by supplying the flag level to the constructor.

Swift
Objective-C
Android
React Native
JavaScript
.net Client
let options = ROXOptions() options.defaultFreezeLevel = .untilForeground ROX.setup(withKey:appKey, options:options) public let someFlag = RoxFlag(withDefault: false, freeze: .untilLaunch)!
ROXOptions *options = [[ROXOptions alloc] init]; options.defaultFreezeLevel = ROXFreeze_untilForeground; [ROX setupWithKey:@"a8c00ba1f04cf4ecbb396a2" options:options]; self.someFlag = [RoxFlag[init] initWithDefaultValue: YES freeze: ROXFreeze_untilLaunch];
RoxOptions options = new RoxOptions.Builder().withFreeze(Freeze.None).build(); Rox.setup(this.getApplication(), options); public RoxFlag someFlag = new RoxFlag(defaultValue, Freeze.UntilLaunch);
Rox.setup(appKey, { freeze: Rox.FreezeOptions.freezeOptionUntilForeground }); someFlag: new Rox.Flag(false, { freeze: Rox.FreezeOptions.freezeOptionUntilLaunch });
Rox.setup(appKey, { freeze: 'untilLaunch' }); someFlag: new Rox.Flag(false, { freeze: 'untilLaunch' });
Rox.Setup(appKey, new RoxOptions(new RoxOptions.RoxOptionsBuilder { Freeze = Freeze.UntilLaunch })); public RoxFlag enableTutorial = new RoxFlag(false, Freeze.UntilForeground);