Deprecate more fields in RegistryConfig

This primarily addresses issues with TMCH testing mode and email sending utils.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143710550
This commit is contained in:
mcilwain 2017-01-05 14:38:38 -08:00 committed by Ben McIlwain
parent c05424b947
commit 25a8bbe890
23 changed files with 203 additions and 265 deletions

View file

@ -15,18 +15,17 @@
package google.registry.util;
import static com.google.common.base.Suppliers.memoizeWithExpiration;
import static google.registry.config.RegistryConfig.getSingletonCachePersistDuration;
import static google.registry.config.RegistryConfig.getSingletonCacheRefreshDuration;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.joda.time.Duration.ZERO;
import com.google.common.base.Supplier;
import google.registry.config.RegistryEnvironment;
import org.joda.time.Duration;
/** Utility methods related to caching. */
public class CacheUtils {
private static final RegistryEnvironment ENVIRONMENT = RegistryEnvironment.get();
/**
* Memoize a supplier, with a short expiration specified in the environment config.
*
@ -34,7 +33,7 @@ public class CacheUtils {
* lists downloaded from the TMCH get updated in datastore and the caches need to be refreshed.)
*/
public static <T> Supplier<T> memoizeWithShortExpiration(Supplier<T> original) {
return memoizeForDuration(original, ENVIRONMENT.config().getSingletonCacheRefreshDuration());
return memoizeForDuration(original, getSingletonCacheRefreshDuration());
}
/**
@ -45,7 +44,7 @@ public class CacheUtils {
* while allowing the production config to set the expiration to forever.
*/
public static <T> Supplier<T> memoizeWithLongExpiration(Supplier<T> original) {
return memoizeForDuration(original, ENVIRONMENT.config().getSingletonCachePersistDuration());
return memoizeForDuration(original, getSingletonCachePersistDuration());
}
/** Memoize a supplier, with a given expiration. */