ICacheApiSetT Method (String, T, TimeSpan, Boolean)
|
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.1.0
Syntax void Set<T>(
string key,
T value,
TimeSpan timeExpiration,
bool sliding
)
Parameters
- key
- Type: SystemString
The key. - value
- Type: T
The value. - timeExpiration
- Type: SystemTimeSpan
The expiration time. - sliding
- Type: SystemBoolean
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.
Examples var cacheApi = ctx.Use<ICacheApi>();
cacheApi.Set("cache_key", "cache_value", new System.TimeSpan(30), true);
See Also