Click or drag to resize

ICacheApiSetT(String, T, TimeSpan, Boolean) Method

Inserts a cache entry into the cache by using a key and a value and specifies whether it is for sliding expiration or time-based expiration.

Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.8.5.0
Syntax
C#
void Set<T>(
	string key,
	T value,
	TimeSpan timeExpiration,
	bool sliding
)

Parameters

key  String
The key.
value  T
The value.
timeExpiration  TimeSpan
The expiration time.
sliding  Boolean
If True, it is sliding expiration. Otherwise, time-based expiration.

Type Parameters

T
Type of the cached object.
Remarks
Inserts a cache entry into the cache by using a key and a value and specifies time-based expiration details.
Sliding expiration means the cache entry should be evicted if it has not been accessed in a given span of time.
Example
C#
var cacheApi = ctx.Use<ICacheApi>();
cacheApi.Set("cache_key", "cache_value", new System.TimeSpan(30), true);
See Also