Retrieves the specified item from the Cache object.

Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)

Syntax

C#
public Object Get(
	string key
)
Visual Basic
Public Function Get ( _
	key As String _
) As Object
Visual C++
public:
Object^ Get(
	String^ key
)

Parameters

key
Type: System..::..String
The identifier for the cache item to retrieve.

Return Value

The retrieved cache item, or a null reference (Nothing in Visual Basic) if the key is not found.

Remarks

Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception incase of failure.

Examples

The following example demonstrates how to retrieve the value cached for an ASP.NET text box server control.
CopyC#
Cache cache = NCache.InitializeCache("myCache");
cache.Get("MyTextBox.Value");

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionkey contains a null reference (Nothing in Visual Basic).
System..::..ArgumentExceptionkey is not serializable.

See Also