다음을 통해 공유


ResourceBundle.Control.GetTimeToLive(String, Locale) Method

Definition

Returns the time-to-live (TTL) value for resource bundles that are loaded under this ResourceBundle.Control.

[Android.Runtime.Register("getTimeToLive", "(Ljava/lang/String;Ljava/util/Locale;)J", "GetGetTimeToLive_Ljava_lang_String_Ljava_util_Locale_Handler")]
public virtual long GetTimeToLive (string baseName, Java.Util.Locale locale);
[<Android.Runtime.Register("getTimeToLive", "(Ljava/lang/String;Ljava/util/Locale;)J", "GetGetTimeToLive_Ljava_lang_String_Ljava_util_Locale_Handler")>]
abstract member GetTimeToLive : string * Java.Util.Locale -> int64
override this.GetTimeToLive : string * Java.Util.Locale -> int64

Parameters

baseName
String

the base name of the resource bundle for which the expiration value is specified.

locale
Locale

the locale of the resource bundle for which the expiration value is specified.

Returns

the time (0 or a positive millisecond offset from the cached time) to get loaded bundles expired in the cache, #TTL_NO_EXPIRATION_CONTROL to disable the expiration control, or #TTL_DONT_CACHE to disable caching.

Attributes

Remarks

Returns the time-to-live (TTL) value for resource bundles that are loaded under this ResourceBundle.Control. Positive time-to-live values specify the number of milliseconds a bundle can remain in the cache without being validated against the source data from which it was constructed. The value 0 indicates that a bundle must be validated each time it is retrieved from the cache. #TTL_DONT_CACHE specifies that loaded resource bundles are not put in the cache. #TTL_NO_EXPIRATION_CONTROL specifies that loaded resource bundles are put in the cache with no expiration control.

The expiration affects only the bundle loading process by the ResourceBundle.getBundle factory method. That is, if the factory method finds a resource bundle in the cache that has expired, the factory method calls the #needsReload(String, Locale, String, ClassLoader, ResourceBundle, long) needsReload method to determine whether the resource bundle needs to be reloaded. If needsReload returns true, the cached resource bundle instance is removed from the cache. Otherwise, the instance stays in the cache, updated with the new TTL value returned by this method.

All cached resource bundles are subject to removal from the cache due to memory constraints of the runtime environment. Returning a large positive value doesn't mean to lock loaded resource bundles in the cache.

The default implementation returns #TTL_NO_EXPIRATION_CONTROL.

Java documentation for java.util.ResourceBundle.Control.getTimeToLive(java.lang.String, java.util.Locale).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to