@@ -15,10 +15,10 @@ component singleton accessors="true" {
15
15
};
16
16
17
17
public boolean function isEnabled (
18
- required string name ,
19
- struct additionalContext = {},
20
- boolean defaultValue = false
21
- ) {
18
+ required string name ,
19
+ struct additionalContext = {},
20
+ boolean defaultValue = false
21
+ ) {
22
22
var feature = getFeature ( arguments .name );
23
23
if ( isNull ( feature ) ) {
24
24
return arguments .defaultValue ;
@@ -28,11 +28,11 @@ component singleton accessors="true" {
28
28
return false ;
29
29
}
30
30
31
- var context = getContext ( arguments .additionalContext );
31
+ var context = getContext ( arguments .additionalContext );
32
32
33
- if ( feature .strategies .isEmpty () ) {
34
- return true ;
35
- }
33
+ if ( feature .strategies .isEmpty () ) {
34
+ return true ;
35
+ }
36
36
37
37
for ( var strategyData in feature .strategies ) {
38
38
var strategy = getStrategy ( strategyData .name );
@@ -55,10 +55,10 @@ component singleton accessors="true" {
55
55
}
56
56
57
57
public boolean function isDisabled (
58
- required string name ,
59
- struct additionalContext = {},
60
- boolean defaultValue = false
61
- ) {
58
+ required string name ,
59
+ struct additionalContext = {},
60
+ boolean defaultValue = false
61
+ ) {
62
62
return ! isEnabled ( argumentCollection = arguments );
63
63
}
64
64
@@ -118,26 +118,17 @@ component singleton accessors="true" {
118
118
}
119
119
120
120
public array function getFeatures () {
121
- try {
122
- return cache .getOrSet (
123
- " unleashsdk-features" ,
124
- function () {
125
- var features = fetchFeatures ();
126
- cache .set ( " unleashsdk-failover" , features , 0 );
127
- return features ;
128
- },
129
- variables .settings .cacheTimeout
130
- );
131
- } catch ( any e ) {
132
- if ( log .canError () ) {
133
- log .error ( " Exception occurred while retrieving Unleash features. Using failover" , e );
134
- }
135
- var features = cache .get ( " unleashsdk-failover" );
136
- if ( isNull ( features ) ) {
137
- return [];
138
- }
139
- return features ;
121
+ var features = cache .get ( " unleashsdk-failover" );
122
+ if ( isNull ( features ) ) {
123
+ return [];
140
124
}
125
+ return features ;
126
+ }
127
+
128
+ public array function refreshFeatures () {
129
+ var features = fetchFeatures ();
130
+ cache .set ( " unleashsdk-failover" , features , 0 );
131
+ return features ;
141
132
}
142
133
143
134
private array function fetchFeatures () {
@@ -161,7 +152,11 @@ component singleton accessors="true" {
161
152
162
153
private struct function getContext ( struct additionalContext = {} ) {
163
154
param request .unleashContext = generateContext ();
164
- structAppend ( arguments .additionalContext , request .unleashContext , false );
155
+ structAppend (
156
+ arguments .additionalContext ,
157
+ request .unleashContext ,
158
+ false
159
+ );
165
160
return arguments .additionalContext ;
166
161
}
167
162
0 commit comments