-
Added support for Contextual Multi-Armed Bandit (CMAB): Added support for CMAB experiments(Contextual Bandits rules) with new configuration options and cache control. To get decision from CMAB rules,
decideAsyncand related methods must be used. The syncdecidemethod does not support CMABs and will just skip CMAB rules while making decision for a flag.The following new options have been added to configure the cmab cache:
import { createInstance } from '@optimizely/optimizely-sdk' const optimizely = createInstance({ // ... other config options cmab: { cacheSize: 1000, // Optional: Set CMAB cache size (default: 1000) cacheTtl: 30 * 60 * 1000, // Optional: Set CMAB cache TTL in milliseconds (default: 30 * 60 * 1000) cache: customCache // Optional: Custom cache implementation, instance of CacheWithRemove interface } });
New decide options are available to control CMAB caching behavior:
-
OptimizelyDecideOption.IGNORE_CMAB_CACHE: Bypass CMAB cache for fresh decisions -
OptimizelyDecideOption.RESET_CMAB_CACHE: Clear and reset CMAB cache before making decisions -
OptimizelyDecideOption.INVALIDATE_USER_CMAB_CACHE: Invalidate CMAB cache for the particular user and experiment
// Example usage with CMAB decide options const decision = await userContext.decideAsync('feature-flag-key', [ optimizelySdk.enums.OptimizelyDecideOption.IGNORE_CMAB_CACHE ]);
-
- Flush events without closing client on page unload which causes event processing to stop working when page is loaded from bfcache (#1087)
- Fixed typo in clientEngine option (#1095)
https://github.com/optimizely/javascript-sdk/releases/tag/v6.2.0
Article is closed for comments.