Retrieves the specified item from the Cache object. If the object is read thru the data source,
put is against the given group and sub group.
Namespace: Alachisoft.NCache.Web.CachingAssembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)
Syntax
C# |
---|
public override Object Get( string key, string group, string subGroup, DSReadOption dsReadOpt ) |
Visual Basic |
---|
Public Overrides Function Get ( _ key As String, _ group As String, _ subGroup As String, _ dsReadOpt As DSReadOption _ ) As Object |
Visual C++ |
---|
public: virtual Object^ Get( String^ key, String^ group, String^ subGroup, DSReadOption dsReadOpt ) override |
Parameters
- key
- Type: System..::..String
The identifier for the cache item to retrieve.
- group
- Type: System..::..String
The group of the cached object
- subGroup
- Type: System..::..String
The subGroup of the cached object
- dsReadOpt
- Type: Alachisoft.NCache.Web.Caching..::..DSReadOption
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.
Note: The group and subGroup parameters are used only if the object is read thru the data source. Otherwise the object will be returned from the cache whether it belongs to the given group and sub group or not.
Examples
The following example demonstrates how to retrieve the value cached for an ASP.NET text
box server control.
Or simply in a class deriving from [!:Alachisoft.NCache.Web.UI.NPage] or [!:Alachisoft.NCache.Web.UI.NUserControl].
CopyC#
NCache.Cache.Get("MyTextBox.Value", "Customer", null);
CopyC#
Cache.Get("MyTextBox.Value", "group", "subGroup", "Customer", null);
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | key contains a null reference (Nothing in Visual Basic). |
System..::..ArgumentException | key is not serializable. |
System..::..ArgumentNullException | group contains a null reference (Nothing in Visual Basic). |