Skip to content

Commit 380d7f9

Browse files
committed
reverting changes to Refactor CacheStats to Stats across all relevant classes and tests as it's pulled out into elastic#131784
1 parent efc5e20 commit 380d7f9

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public int count() {
120120
* @return Current stats about this cache
121121
*/
122122
public CacheStats getCacheStats() {
123-
Cache.Stats stats = cache.stats();
123+
Cache.CacheStats stats = cache.stats();
124124
return new CacheStats(
125125
cache.count(),
126126
stats.getHits(),

server/src/main/java/org/elasticsearch/common/cache/Cache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ default void refresh() {}
141141
*
142142
* @return the current cache statistics
143143
*/
144-
Stats stats();
144+
CacheStats stats();
145145

146146
/**
147147
* Performs an action for each cache entry in the cache. While iterating over the cache entries this method might use locks. As such,
@@ -157,7 +157,7 @@ default void refresh() {}
157157
* @param misses number of times no cached value could be found
158158
* @param evictions number of entries that have been evicted
159159
*/
160-
record Stats(long hits, long misses, long evictions) {
160+
record CacheStats(long hits, long misses, long evictions) {
161161

162162
public long getHits() {
163163
return hits;

server/src/main/java/org/elasticsearch/common/cache/LRUCache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ public void remove() {
746746
*
747747
* @return the current cache statistics
748748
*/
749-
public Stats stats() {
750-
return new Stats(hits.sum(), misses.sum(), evictions.sum());
749+
public CacheStats stats() {
750+
return new CacheStats(hits.sum(), misses.sum(), evictions.sum());
751751
}
752752

753753
private void promote(Entry<K, V> entry, long now) {

server/src/test/java/org/elasticsearch/common/cache/CacheTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public void testStats() {
184184
cache.invalidate(entry);
185185
}
186186

187-
Cache.Stats stats = cache.stats();
187+
Cache.CacheStats stats = cache.stats();
188188
assertEquals(expectedHits, stats.getHits());
189189
assertEquals(expectedMisses, stats.getMisses());
190190
assertEquals(invalidations, stats.getEvictions());

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/FieldPermissionsCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public FieldPermissionsCache(Settings settings) {
4949
.build();
5050
}
5151

52-
public Cache.Stats getCacheStats() {
52+
public Cache.CacheStats getCacheStats() {
5353
return cache.stats();
5454
}
5555

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/RoleDescriptorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
578578
FieldPermissionsCache fieldPermissionsCache = new FieldPermissionsCache(Settings.EMPTY);
579579
RoleDescriptor.setFieldPermissionsCache(fieldPermissionsCache);
580580

581-
final Cache.Stats beforeStats = fieldPermissionsCache.getCacheStats();
581+
final Cache.CacheStats beforeStats = fieldPermissionsCache.getCacheStats();
582582

583583
final String json = """
584584
{
@@ -604,7 +604,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
604604
RoleDescriptor.parserBuilder().build().parse("test", new BytesArray(json), XContentType.JSON);
605605

606606
final int numberOfFieldSecurityBlocks = 2;
607-
final Cache.Stats betweenStats = fieldPermissionsCache.getCacheStats();
607+
final Cache.CacheStats betweenStats = fieldPermissionsCache.getCacheStats();
608608
assertThat(betweenStats.getMisses(), equalTo(beforeStats.getMisses() + numberOfFieldSecurityBlocks));
609609
assertThat(betweenStats.getHits(), equalTo(beforeStats.getHits()));
610610

@@ -613,7 +613,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
613613
RoleDescriptor.parserBuilder().build().parse("test", new BytesArray(json), XContentType.JSON);
614614
}
615615

616-
final Cache.Stats afterStats = fieldPermissionsCache.getCacheStats();
616+
final Cache.CacheStats afterStats = fieldPermissionsCache.getCacheStats();
617617
assertThat(afterStats.getMisses(), equalTo(betweenStats.getMisses()));
618618
assertThat(afterStats.getHits(), equalTo(beforeStats.getHits() + numberOfFieldSecurityBlocks * iterations));
619619
}

x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void put(CacheKey cacheKey, CacheValue cacheValue) {
137137
}
138138

139139
public EnrichStatsAction.Response.CacheStats getStats(String localNodeId) {
140-
Cache.Stats stats = cache.stats();
140+
Cache.CacheStats stats = cache.stats();
141141
return new EnrichStatsAction.Response.CacheStats(
142142
localNodeId,
143143
cache.count(),

0 commit comments

Comments
 (0)