Property Expiration
Expiration
This property sets Expiration for the cache item. After the specified timespan,
the item expires from cache.
Declaration
public Expiration Expiration { get; set; }
Property Value
Type | Description |
---|---|
Expiration | This property specifies the time after which the message is expired from the cache. |
Examples
The following example sets the sliding expiration of a CacheItem as 5 minutes.
Product product = new Product();
product.Id = 1;
product.Name = "Chai";
CacheItem item = new CacheItem(product);
item.Expiration = new Expiration(ExpirationType.Sliding, TimeSpan.FromMinutes(5));