Remove deprecated methods on ServerCache getHitRatio() -> hitRatio(), getStatistics() -> statistics()

This commit is contained in:
Rob Bygrave
2022-04-07 17:03:04 +12:00
parent e22e5885e2
commit ff257a272b
6 changed files with 16 additions and 56 deletions
+8 -15
View File
@@ -1,5 +1,6 @@
package io.ebean.cache;
import io.avaje.lang.Nullable;
import io.ebean.meta.MetricVisitor;
import java.util.LinkedHashMap;
@@ -68,36 +69,27 @@ public interface ServerCache {
/**
* Return the number of entries in the cache.
*/
int size();
default int size() {
return 0;
}
/**
* Return the hit ratio the cache is currently getting.
*/
default int hitRatio() {
return getHitRatio();
return 0;
}
/**
* Deprecated migrate to hitRatio().
*/
@Deprecated
int getHitRatio();
/**
* Return statistics for the cache.
*
* @param reset if true the statistics are reset.
*/
@Nullable
default ServerCacheStatistics statistics(boolean reset) {
return getStatistics(reset);
return null;
}
/**
* Deprecated migrate to statistics().
*/
@Deprecated
ServerCacheStatistics getStatistics(boolean reset);
/**
* Visit the metrics for the cache.
*/
@@ -108,6 +100,7 @@ public interface ServerCache {
/**
* Unwrap the underlying ServerCache.
*/
@SuppressWarnings("unchecked")
default <T> T unwrap(Class<T> cls) {
return (T) this;
}
@@ -69,13 +69,13 @@ public final class TenantAwareCache implements ServerCache {
}
@Override
public int getHitRatio() {
return delegate.getHitRatio();
public int hitRatio() {
return delegate.hitRatio();
}
@Override
public ServerCacheStatistics getStatistics(boolean reset) {
return delegate.getStatistics(reset);
public ServerCacheStatistics statistics(boolean reset) {
return delegate.statistics(reset);
}
@Override