Property Expiration
Expiration
This property sets Expiration for the cache itme. After the specified timespan,
the item expires from cache.
Declaration
public Expiration Expiration { get; set; }
Property Value
Type | Description |
---|---|
Expiration |
Examples
Example sets sliding expiration of a cache item 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));