@@ -379,6 +379,49 @@ You can use `get_enabled_features` method for scenarios where you need a list of
379
379
380
380
## Advanced
381
381
382
+ ### Adjusting in-memory cache
383
+
384
+ By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.
385
+
386
+ You can override ` max_age ` parameter when instantiating the store.
387
+
388
+ ```python hl_lines="7"
389
+ from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
390
+
391
+ app_config = AppConfigStore(
392
+ environment="dev",
393
+ application="product-catalogue",
394
+ name="features",
395
+ max_age=300
396
+ )
397
+ ```
398
+
399
+ ### Getting fetched configuration
400
+
401
+ ???+ info "When is this useful?"
402
+ You might have application configuration in addition to feature flags in your store.
403
+
404
+ This means you don't need to make another call only to fetch app configuration.
405
+
406
+ You can access the configuration fetched from the store via ` get_raw_configuration ` property within the store instance.
407
+
408
+ === "app.py"
409
+
410
+ ```python hl_lines="12"
411
+ from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
412
+
413
+ app_config = AppConfigStore(
414
+ environment="dev",
415
+ application="product-catalogue",
416
+ name="configuration",
417
+ envelope = "feature_flags"
418
+ )
419
+
420
+ feature_flags = FeatureFlags(store=app_config)
421
+
422
+ config = app_config.get_raw_configuration
423
+ ```
424
+
382
425
### Schema
383
426
384
427
This utility expects a certain schema to be stored as JSON within AWS AppConfig.
@@ -497,23 +540,6 @@ Now that you've seen all properties of a feature flag schema, this flowchart des
497
540
498
541
![ Rule engine ] ( ../media/feature_flags_diagram.png )
499
542
500
- ### Adjusting in-memory cache
501
-
502
- By default, we cache configuration retrieved from the Store for 5 seconds for performance and reliability reasons.
503
-
504
- You can override ` max_age ` parameter when instantiating the store.
505
-
506
- ```python hl_lines="7"
507
- from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
508
-
509
- app_config = AppConfigStore(
510
- environment="dev",
511
- application="product-catalogue",
512
- name="features",
513
- max_age=300
514
- )
515
- ```
516
-
517
543
### Envelope
518
544
519
545
There are scenarios where you might want to include feature flags as part of an existing application configuration.
@@ -564,26 +590,6 @@ For this to work, you need to use a JMESPath expression via the `envelope` param
564
590
}
565
591
```
566
592
567
- ### Getting fetched configuration
568
-
569
- You can access the configuration fetched from the store via ` get_raw_configuration ` property within the store instance.
570
-
571
- === "app.py"
572
-
573
- ```python hl_lines="12"
574
- from aws_lambda_powertools.utilities.feature_flags import FeatureFlags, AppConfigStore
575
-
576
- app_config = AppConfigStore(
577
- environment="dev",
578
- application="product-catalogue",
579
- name="configuration",
580
- envelope = "feature_flags"
581
- )
582
-
583
- feature_flags = FeatureFlags(store=app_config)
584
-
585
- config = app_config.get_raw_configuration
586
- ```
587
593
588
594
### Built-in store provider
589
595
0 commit comments