Language

Cache.Add Method (String, String, Object)

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Adds an object to the cache. Provides the option to save the object to a region.

Namespace: System.Data.Caching
Assembly: ClientLibrary (in clientlibrary.dll)

Syntax

'Declaration
Public Function Add ( _
    region As String, _
    key As String, _
    value As Object _
) As CacheItemVersion
'Usage
Dim instance As Cache
Dim region As String
Dim key As String
Dim value As Object
Dim returnValue As CacheItemVersion

returnValue = instance.Add(region, key, value)
public CacheItemVersion Add (
    string region,
    string key,
    Object value
)
public:
CacheItemVersion^ Add (
    String^ region, 
    String^ key, 
    Object^ value
)
public CacheItemVersion Add (
    String region, 
    String key, 
    Object value
)
public function Add (
    region : String, 
    key : String, 
    value : Object
) : CacheItemVersion

Parameters

  • region
    The name of the region to which to save the object. Use DefaultRegion if the object is not stored in a region.
  • key
    A unique value that is used to store and retrieve the object from the region or cache.
  • value
    The object saved to the cache cluster.

Return Value

A CacheItemVersion object that represents the version of the object saved to the cache under the key value.

Remarks

An exception is thrown if an item using the same key already occurs in the cache. Expiration settings are derived from the named cache configuration. For more information, see Expiration and Eviction (Velocity). For more information about how to use this method, see How to: Add an Object to Cache (Velocity).

See Also

Reference

Cache Class
Cache Members
System.Data.Caching Namespace