mirror of
https://github.com/google/nomulus.git
synced 2025-06-02 10:38:41 +02:00
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:
parent
c05424b947
commit
25a8bbe890
23 changed files with 203 additions and 265 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue