Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public int count() {
* @return Current stats about this cache
*/
public CacheStats getCacheStats() {
Cache.CacheStats stats = cache.stats();
Cache.Stats stats = cache.stats();
return new CacheStats(
cache.count(),
stats.getHits(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,16 +746,16 @@ public void remove() {
*
* @return the current cache statistics
*/
public CacheStats stats() {
return new CacheStats(this.hits.sum(), misses.sum(), evictions.sum());
public Stats stats() {
return new Stats(this.hits.sum(), misses.sum(), evictions.sum());
}

public static class CacheStats {
public static class Stats {
private final long hits;
private final long misses;
private final long evictions;

public CacheStats(long hits, long misses, long evictions) {
public Stats(long hits, long misses, long evictions) {
this.hits = hits;
this.misses = misses;
this.evictions = evictions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public FieldPermissionsCache(Settings settings) {
.build();
}

public Cache.CacheStats getCacheStats() {
public Cache.Stats getCacheStats() {
return cache.stats();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public void testParsingFieldPermissionsUsesCache() throws IOException {
FieldPermissionsCache fieldPermissionsCache = new FieldPermissionsCache(Settings.EMPTY);
RoleDescriptor.setFieldPermissionsCache(fieldPermissionsCache);

final Cache.CacheStats beforeStats = fieldPermissionsCache.getCacheStats();
final Cache.Stats beforeStats = fieldPermissionsCache.getCacheStats();

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

final int numberOfFieldSecurityBlocks = 2;
final Cache.CacheStats betweenStats = fieldPermissionsCache.getCacheStats();
final Cache.Stats betweenStats = fieldPermissionsCache.getCacheStats();
assertThat(betweenStats.getMisses(), equalTo(beforeStats.getMisses() + numberOfFieldSecurityBlocks));
assertThat(betweenStats.getHits(), equalTo(beforeStats.getHits()));

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

final Cache.CacheStats afterStats = fieldPermissionsCache.getCacheStats();
final Cache.Stats afterStats = fieldPermissionsCache.getCacheStats();
assertThat(afterStats.getMisses(), equalTo(betweenStats.getMisses()));
assertThat(afterStats.getHits(), equalTo(beforeStats.getHits() + numberOfFieldSecurityBlocks * iterations));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void put(CacheKey cacheKey, CacheValue cacheValue) {
}

public EnrichStatsAction.Response.CacheStats getStats(String localNodeId) {
Cache.CacheStats cacheStats = cache.stats();
Cache.Stats cacheStats = cache.stats();
return new EnrichStatsAction.Response.CacheStats(
localNodeId,
cache.count(),
Expand Down