microsoft/teams.net
Publicmirrored from https://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Apps/State/TurnStateOptions.cs
28lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | using Microsoft.Extensions.Caching.Distributed; |
| 5 | |
| 6 | namespace Microsoft.Teams.Apps.State; |
| 7 | |
| 8 | /// <summary> |
| 9 | /// Configuration options for turn state management. |
| 10 | /// </summary> |
| 11 | public class TurnStateOptions |
| 12 | { |
| 13 | /// <summary> |
| 14 | /// Gets or sets the cache entry options applied when saving state. |
| 15 | /// Defaults to a 1-hour sliding expiration. |
| 16 | /// </summary> |
| 17 | public DistributedCacheEntryOptions CacheEntryOptions { get; set; } = new() |
| 18 | { |
| 19 | SlidingExpiration = TimeSpan.FromHours(1) |
| 20 | }; |
| 21 | |
| 22 | /// <summary> |
| 23 | /// Gets or sets the prefix for cache keys. |
| 24 | /// Defaults to <c>"ts"</c>. Change this to isolate state when multiple bots share the same cache. |
| 25 | /// Keys are formatted as <c>{KeyPrefix}:conv:{conversationId}</c> and <c>{KeyPrefix}:user:{conversationId}:{userId}</c>. |
| 26 | /// </summary> |
| 27 | public string KeyPrefix { get; set; } = "ts"; |
| 28 | } |
| 29 | |