#2352 - Rename ServerCache methods with deprecation

This commit is contained in:
rbygrave
2021-09-03 17:24:33 +12:00
parent 7c2a77081b
commit aa53742a07
33 changed files with 212 additions and 149 deletions
+16 -2
View File
@@ -10,12 +10,10 @@ import java.util.Set;
* Represents part of the "L2" server side cache.
* <p>
* This is used to cache beans or query results (bean collections).
* </p>
* <p>
* There are 2 ServerCache's for each bean type. One is used as the 'bean cache'
* which holds beans of a given type. The other is the 'query cache' holding
* query results for a given type.
* </p>
*/
public interface ServerCache {
@@ -75,6 +73,14 @@ public interface ServerCache {
/**
* Return the hit ratio the cache is currently getting.
*/
default int hitRatio() {
return getHitRatio();
}
/**
* Deprecated migrate to hitRatio().
*/
@Deprecated
int getHitRatio();
/**
@@ -82,6 +88,14 @@ public interface ServerCache {
*
* @param reset if true the statistics are reset.
*/
default ServerCacheStatistics statistics(boolean reset) {
return getStatistics(reset);
}
/**
* Deprecated migrate to statistics().
*/
@Deprecated
ServerCacheStatistics getStatistics(boolean reset);
/**
@@ -21,7 +21,15 @@ public interface ServerCacheManager {
* rather than background processing.
* </p>
*/
boolean isLocalL2Caching();
boolean localL2Caching();
/**
* Deprecated migrate to localL2Caching().
*/
@Deprecated
default boolean isLocalL2Caching() {
return localL2Caching();
}
/**
* Return all the cache regions.
@@ -36,37 +44,78 @@ public interface ServerCacheManager {
*
* @param regions A region name or comma delimited list of region names.
*/
void setEnabledRegions(String regions);
void enabledRegions(String regions);
/**
* Deprecated migrate to enabledRegions().
*/
@Deprecated
default void setEnabledRegions(String regions) {
enabledRegions(regions);
}
/**
* Enable or disable all the cache regions.
*/
void setAllRegionsEnabled(boolean enabled);
void allRegionsEnabled(boolean enabled);
/**
* Deprecated migrate to allRegionsEnabled().
*/
@Deprecated
default void setAllRegionsEnabled(boolean enabled) {
allRegionsEnabled(enabled);
}
/**
* Return the cache region by name. Typically, to enable or disable the region.
*/
ServerCacheRegion getRegion(String name);
ServerCacheRegion region(String name);
@Deprecated
default ServerCacheRegion getRegion(String name) {
return region(name);
}
/**
* Return the cache for mapping natural keys to id values.
*/
ServerCache getNaturalKeyCache(Class<?> beanType);
ServerCache naturalKeyCache(Class<?> beanType);
@Deprecated
default ServerCache getNaturalKeyCache(Class<?> beanType) {
return naturalKeyCache(beanType);
}
/**
* Return the cache for beans of a particular type.
*/
ServerCache getBeanCache(Class<?> beanType);
ServerCache beanCache(Class<?> beanType);
@Deprecated
default ServerCache getBeanCache(Class<?> beanType) {
return beanCache(beanType);
}
/**
* Return the cache for associated many properties of a bean type.
*/
ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName);
ServerCache collectionIdsCache(Class<?> beanType, String propertyName);
@Deprecated
default ServerCache getCollectionIdsCache(Class<?> beanType, String propertyName) {
return collectionIdsCache(beanType, propertyName);
}
/**
* Return the cache for query results of a particular type of bean.
*/
ServerCache getQueryCache(Class<?> beanType);
ServerCache queryCache(Class<?> beanType);
@Deprecated
default ServerCache getQueryCache(Class<?> beanType) {
return queryCache(beanType);
}
/**
* This clears both the bean and query cache for a given type.