Class CachingOptions
This class represents the cache options applied to a certain item/result set, before inserting it into the cache. These caching options include adding a QueryIdentifier against the query result set, creating a DB dependency, setting item expiration time, etc.
Inheritance
Assembly: Alachisoft.NCache.EntityFrameworkCore.dll
Syntax
public class CachingOptions : ICloneable
Constructors
CachingOptions()
Creates an instance of the CachingOptions with default values.
Declaration
public CachingOptions()
Properties
AbsoluteExpirationTime
Gets the absolute time when the item will expire.
Declaration
public DateTime AbsoluteExpirationTime { get; }
Property Value
Type | Description |
---|---|
DateTime | Returns the absolute time when the item will expire. |
CreateDbDependency
Specifies whether to create a Db dependency with the result set or not.
Declaration
public bool CreateDbDependency { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Boolean value true or false. |
ExpirationType
Returns the configured expiration type.
Declaration
public ExpirationType ExpirationType { get; }
Property Value
Type | Description |
---|---|
Alachisoft.NCache.EntityFrameworkCore.ExpirationType | Returns the configured expiration type. |
IsSyncEnabled
Returns whether the CacheSyncOption is enabled or disabled.
Declaration
public bool IsSyncEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Returns a Boolean value either true or false. |
Priority
Sets the relative priority of the item as compared to other cached items. Higher priority items are less likely to be deleted from cache on eviction.
Declaration
public Runtime.CacheItemPriority Priority { get; set; }
Property Value
Type | Description |
---|---|
Runtime.CacheItemPriority | Specifies the priority of the item. Low priority items are evicted first when eviction is triggered. |
QueryIdentifier
Identifier for a query which is added as a Tag against the result set of the query in the cache. This must be unique for each unique query. The QueryIdentifier is used to regenerate the result set from the cache upon execution of the same query. The user must maintain a mapping of the query against the query identifier to be used in the future. If not specified, NCache adds the query string itself as the tag (making it unique for each unique query). For example, a query which returns a Customer is not tagged by the user. The next time the same query is executed, the query string is searched as a tag within the cache and if it exists, the result set against it will be returned.
Declaration
public string QueryIdentifier { get; set; }
Property Value
Type | Description |
---|---|
System.String | Identifier for a query which is added against the result set of the query in cache. |
ReadThruProvider
Returns the ReadThru Provider name configured for cache synchronization.
Declaration
public string ReadThruProvider { get; }
Property Value
Type | Description |
---|---|
System.String | Returns the Resync Provider name configured for cache synchronization. |
SlidingExpirationTime
Returns the sliding expiration time span of the item that will be cached.
Declaration
public TimeSpan SlidingExpirationTime { get; }
Property Value
Type | Description |
---|---|
TimeSpan | Returns the sliding expiration time span of the item that will be cached. |
StoreAs
Specifies whether the result set should be stored as seperate entities or as a collection.
Declaration
public StoreAs StoreAs { get; set; }
Property Value
Type | Description |
---|---|
StoreAs | Specifies whether the result set should be stored as seperate entities or as a collection. |
Methods
Clone()
Creates a shallow copy of the CachingOptions instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | Returns a shallow copy of the instance. |
SetAbsoluteExpiration(DateTime)
Sets the absolute expiration time of the cache item. Only one type of expiration, either absolute or sliding expiration can be configured at one time.
Declaration
public void SetAbsoluteExpiration(DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | The absolute date time after which the item will be expired from the cache. |
SetResyncProviderName(String)
This method sets the ResyncProviderName.
Declaration
public void SetResyncProviderName(string resyncProviderName)
Parameters
Type | Name | Description |
---|---|---|
System.String | resyncProviderName | Name of the resync provider. |
SetSlidingExpiration(TimeSpan)
Sets the sliding expiration time of the cache item. Only one type of expiration, either absolute or sliding expiration can be configured at one time.
Declaration
public void SetSlidingExpiration(TimeSpan timespan)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timespan | The time span where if the item is not accessed it will be expired from the cache. |