@@ -41,41 +41,35 @@ export class SplitsCacheInMemory extends AbstractSplitsCacheSync {
41
41
if ( usesSegments ( previousSplit ) ) this . segmentsCount -- ;
42
42
}
43
43
44
- if ( split ) {
45
- // Store the Split.
46
- this . splitsCache [ name ] = split ;
47
- // Update TT cache
48
- const ttName = split . trafficTypeName ;
49
- this . ttCache [ ttName ] = ( this . ttCache [ ttName ] || 0 ) + 1 ;
50
- this . addToFlagSets ( split ) ;
51
-
52
- // Add to segments count for the new version of the Split
53
- if ( usesSegments ( split ) ) this . segmentsCount ++ ;
54
-
55
- return true ;
56
- } else {
57
- return false ;
58
- }
44
+ // Store the Split.
45
+ this . splitsCache [ name ] = split ;
46
+ // Update TT cache
47
+ const ttName = split . trafficTypeName ;
48
+ this . ttCache [ ttName ] = ( this . ttCache [ ttName ] || 0 ) + 1 ;
49
+ this . addToFlagSets ( split ) ;
50
+
51
+ // Add to segments count for the new version of the Split
52
+ if ( usesSegments ( split ) ) this . segmentsCount ++ ;
53
+
54
+ return true ;
59
55
}
60
56
61
57
removeSplit ( name : string ) : boolean {
62
58
const split = this . getSplit ( name ) ;
63
- if ( split ) {
64
- // Delete the Split
65
- delete this . splitsCache [ name ] ;
59
+ if ( ! split ) return false ;
66
60
67
- const ttName = split . trafficTypeName ;
68
- this . ttCache [ ttName ] -- ; // Update tt cache
69
- if ( ! this . ttCache [ ttName ] ) delete this . ttCache [ ttName ] ;
70
- this . removeFromFlagSets ( split . name , split . sets ) ;
61
+ // Delete the Split
62
+ delete this . splitsCache [ name ] ;
71
63
72
- // Update the segments count.
73
- if ( usesSegments ( split ) ) this . segmentsCount -- ;
64
+ const ttName = split . trafficTypeName ;
65
+ this . ttCache [ ttName ] -- ; // Update tt cache
66
+ if ( ! this . ttCache [ ttName ] ) delete this . ttCache [ ttName ] ;
67
+ this . removeFromFlagSets ( split . name , split . sets ) ;
74
68
75
- return true ;
76
- } else {
77
- return false ;
78
- }
69
+ // Update the segments count.
70
+ if ( usesSegments ( split ) ) this . segmentsCount -- ;
71
+
72
+ return true ;
79
73
}
80
74
81
75
getSplit ( name : string ) : ISplit | null {
0 commit comments