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.ApiAssembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.8.5.0
Syntaxvoid 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.
Examplevar cacheApi = ctx.Use<ICacheApi>();
cacheApi.Set("cache_key", "cache_value", new System.TimeSpan(30), true);
See Also