@@ -48,8 +48,9 @@ public boolean match(String cacheName, Object key) {
48
48
}
49
49
50
50
private boolean matchSearchServiceScrollCacheKey (Object key ) {
51
- Octet <?, List <String >, String , String , ?, ?, List <String >, ?> cacheKey
52
- = (Octet <?, List <String >, String , String , ?, ?, List <String >, ?>) key ;
51
+ Octet <?, List <String >, String , String , ?, ?, List <String >, ?> cacheKey =
52
+ (Octet <?, List <String >, String , String , ?, ?, List <String >, ?>) key ;
53
+ // For reference - cache key contents
53
54
// @Nonnull OperationContext opContext,
54
55
// @Nonnull List<String> entities,
55
56
// @Nonnull String query,
@@ -63,34 +64,53 @@ private boolean matchSearchServiceScrollCacheKey(Object key) {
63
64
String query = (String ) cacheKey .getValue (2 );
64
65
List <String > facets = (List <String >) cacheKey .getValue (6 );
65
66
66
- //Facets may contain urns. Since the check for urns in filters is similar, can append it to the filter.
67
- return isKeyImpactedByEntity (entitiesInCacheKey , query , filter + " " + String .join (" " ,facets ));
67
+ // Facets may contain urns. Since the check for urns in filters is similar, can append it to the
68
+ // filter.
69
+ return isKeyImpactedByEntity (
70
+ entitiesInCacheKey , query , filter + " " + String .join (" " , facets ));
68
71
}
69
72
70
73
private boolean matchSearchServiceCacheKey (Object key ) {
71
74
Septet <?, List <String >, ?, String , ?, ?, ?> cacheKey =
72
75
(Septet <?, List <String >, ?, String , ?, ?, ?>) key ;
76
+ // For reference
77
+ // @Nonnull OperationContext opContext,
78
+ // @Nonnull List<String> entityNames,
79
+ // @Nonnull String query,
80
+ // @Nullable Filter filters,
81
+ // List<SortCriterion> sortCriteria,
82
+ // @Nonnull List<String> facets
83
+ // querySize
73
84
74
85
List <String > entitiesInCacheKey = (List <String >) cacheKey .getValue (1 );
75
86
String filter = (String ) cacheKey .getValue (3 );
76
87
String query = (String ) cacheKey .getValue (2 );
88
+ List <String > facets = (List <String >) cacheKey .getValue (5 );
89
+
90
+ // Facets may contain urns. Since the check for urns in filters is similar, can append it to the
91
+ // filter.
92
+ if (filter == null ) {
93
+ filter = "" ;
94
+ }
95
+ filter += " " + String .join (" " , facets );
77
96
78
97
return isKeyImpactedByEntity (entitiesInCacheKey , query , filter );
79
98
}
80
99
81
- boolean isKeyImpactedByEntity (List <String > entitiesInCacheKey , String query , String filter ){
100
+ boolean isKeyImpactedByEntity (List <String > entitiesInCacheKey , String query , String filter ) {
82
101
boolean entityMatch = entitiesInCacheKey .stream ().anyMatch (entityTypes ::contains );
83
102
if (!entityMatch ) {
84
103
return false ;
85
104
}
86
105
87
- if (filter == null ){ //No filter, but already established there is an entity match
106
+ if (filter == null ) { // No filter, but already established there is an entity match
88
107
return true ;
89
108
}
90
109
91
- // Ignoring query for now. A query could make this cache entry more targeted, but till there is a quick way to
92
- // evaluate if the entities that were updated are affected by this query, ignoring it may mean some cache entries
93
- // are invalidated even if they may not be a match, and an uncached query result will still be fetched.
110
+ // Ignoring query for now. A query could make this cache entry more targeted, but till there is
111
+ // a quick way to evaluate if the entities that were updated are affected by this query,
112
+ // ignoring it may mean some cache entries are invalidated even if they may not be a match,
113
+ // and an uncached query result will still be fetched.
94
114
95
115
boolean containsUrn = filter .contains ("urn:li" );
96
116
if (!containsUrn ) {
0 commit comments