Retrieves the specified item from the Cache object. If the object is read through the data source, put it against the given group and sub group.

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

Syntax

C#
public virtual Object Get(
	string key,
	string group,
	string subGroup,
	DSReadOption dsReadOption
)
Visual Basic
Public Overridable Function Get ( 
	key As String,
	group As String,
	subGroup As String,
	dsReadOption As DSReadOption
) As Object
Visual C++
public:
virtual Object^ Get(
	String^ key, 
	String^ group, 
	String^ subGroup, 
	DSReadOption dsReadOption
)

Parameters

key
Type: System..::..String
The identifier for the cache item to retrieve.
group
Type: System..::..String
The name of the group which the item belongs to.
subGroup
Type: System..::..String
The name of the subGroup within a group.
dsReadOption
Type: Alachisoft.NCache.Web.Caching..::..DSReadOption
Options regarding reading from data source.

Return Value

Type: Object
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. The version of the cached object is also received.
 Copy imageCopy
Cache cache = NCache.InitializeCache("myCache");
CacheItemVersion version = null;
string textBoxValue = (string) cache.Get("MyTextBox.Value", "Customer", null, DSReadOption.ReadThru);

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionkey contains a null reference (Nothing in Visual Basic).
System..::..ArgumentNullExceptiongroup contains a null reference (Nothing in Visual Basic).

See Also