ObjectCache.GetValues Method

Definition

Gets a set of cache entries.

Overloads

GetValues(IEnumerable<String>, String)

When overridden in a derived class, gets a set of cache entries that correspond to the specified keys.

GetValues(String, String[])

Gets a set of cache entries that correspond to the specified keys.

GetValues(IEnumerable<String>, String)

Source:
ObjectCache.cs
Source:
ObjectCache.cs
Source:
ObjectCache.cs

When overridden in a derived class, gets a set of cache entries that correspond to the specified keys.

C#
public abstract System.Collections.Generic.IDictionary<string,object> GetValues(System.Collections.Generic.IEnumerable<string> keys, string regionName = default);

Parameters

keys
IEnumerable<String>

A collection of unique identifiers for the cache entries to get.

regionName
String

Optional. A named region in the cache to which the cache entry or entries were added, if regions are implemented. The default value for the optional parameter is null.

Returns

A dictionary of key/value pairs that represent cache entries.

Remarks

The GetValues(IEnumerable<String>, String) method overload is a performance optimization for distributed caches that support fetching multiple cache entries from the cache during a single network call.

Although a caller can pass one or more keys to the method, there is no guarantee that all keys represent entries in the cache. Therefore, the returned dictionary might contain fewer items than the number of keys that were passed to the method.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

GetValues(String, String[])

Source:
ObjectCache.cs
Source:
ObjectCache.cs
Source:
ObjectCache.cs

Gets a set of cache entries that correspond to the specified keys.

C#
public virtual System.Collections.Generic.IDictionary<string,object> GetValues(string regionName, params string[] keys);

Parameters

regionName
String

Optional. A named region in the cache to which the cache entry or entries were added, if regions are implemented. Because regions are not implemented in .NET Framework 4, the default is null.

keys
String[]

A collection of unique identifiers for the cache entries to get.

Returns

A dictionary of key/value pairs that represent cache entries.

Remarks

The ObjectCache.GetValues method overload is like the GetValues(IEnumerable<String>, String) method overload, but lets you pass the named region by using optional parameter syntax that is supported by managed languages such as C#.

This method is a virtual method because the ObjectCache class provides a default implementation that passes the params array to the GetValues(IEnumerable<String>, String) method overload.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)