WebCache.Set(String, Object, Int32, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Inserts an item into the WebCache object.
public static void Set(string key, object value, int minutesToCache = 20, bool slidingExpiration = true);
static member Set : string * obj * int * bool -> unit
Public Shared Sub Set (key As String, value As Object, Optional minutesToCache As Integer = 20, Optional slidingExpiration As Boolean = true)
Parameters
- key
- String
The identifier for the cache item.
- value
- Object
The data to insert into the cache.
- minutesToCache
- Int32
Optional. The number of minutes to keep an item in the cache. The default is 20.
- slidingExpiration
- Boolean
Optional. true to indicate that the cache item expiration is reset each time the item is accessed, or false to indicate that the expiration is based the absolute time since the item was added to the cache. The default is true. In that case, if you also use the default value for the minutesToCache
parameter, a cached item expires 20 minutes after it was last accessed.
Exceptions
Sliding expiration is enabled and the value of minutesToCache
is greater than a year.