Partager via


LruCache.Create(Object) Method

Definition

Called after a cache miss to compute a value for the corresponding key.

[Android.Runtime.Register("create", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetCreate_Ljava_lang_Object_Handler")]
protected virtual Java.Lang.Object? Create (Java.Lang.Object? key);
[<Android.Runtime.Register("create", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetCreate_Ljava_lang_Object_Handler")>]
abstract member Create : Java.Lang.Object -> Java.Lang.Object
override this.Create : Java.Lang.Object -> Java.Lang.Object

Parameters

key
Object

Returns

Attributes

Remarks

Called after a cache miss to compute a value for the corresponding key. Returns the computed value or null if no value can be computed. The default implementation returns null.

The method is called without synchronization: other threads may access the cache while this method is executing.

If a value for key exists in the cache when this method returns, the created value will be released with #entryRemoved and discarded. This can occur when multiple threads request the same key at the same time (causing multiple values to be created), or when one thread calls #put while another is creating a value for the same key.

Java documentation for android.util.LruCache.create(K).

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