Interface IMutableEntry
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
public interface IMutableEntry
Properties
Key
Gets the key of cache entry on which entry processor has to be executed.
Declaration
string Key { get; }
Property Value
Type | Description |
---|---|
System.String | Returns key of the associated cahe entry. |
Examples
Example looks for string Product in Key property of Mutable Entry
if (entry.Exists())
{
if (entry.Key.Contains("Product"))
{
return "It is a product.";
}
else
{
return "Unknown data";
}
}
Value
Sets/Gets data for relevant key.
Declaration
object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The data of the relevant key. |
Examples
Example get the value of the entry and returns its type
if (entry.Exists())
{
return entry.Value.GetType().FullName;
}
Methods
Exists()
Checks, if the required key for Entry Processor exists in cache or not.
Declaration
bool Exists()
Returns
Type | Description |
---|---|
System.Boolean | Returns true, if key exists or vice versa. |
Examples
Example returns string based on existence of entry to be processed in cache
if (entry.Exists())
{
return "Key exists.";
}
else
{
return "Key does not exist.";
}
Remove()
Removes the key from cache after executing the entry processor.
Declaration
void Remove()
Examples
Example removes entry from cache after processing
if (entry.Key.Contains("Product"))
{
entry.Remove();
return "Removed.";
}
UnWrap(Type)
Convert data type of the value.
Declaration
object UnWrap(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | New data Type. |
Returns
Type | Description |
---|---|
System.Object | Value with updated data type. |
Examples
Example unwraps the entry into string and returns
if (entry.Exists())
{
return entry.UnWrap(typeof(string));
}