Skip to content

Commit b5d8481

Browse files
author
Sophia Tevosyan
committed
added comments
1 parent 044f780 commit b5d8481

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Worker/Grpc/ExtendedSessionsCache.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,27 @@
55

66
namespace Microsoft.DurableTask.Worker.Grpc;
77

8+
/// <summary>
9+
/// A cache for extended sessions that wraps an <see cref="IMemoryCache"/> instance.
10+
/// Responsible for holding <see cref="ExtendedSessionState"/> for orchestrations that are running within extended sessions.
11+
/// </summary>
812
public class ExtendedSessionsCache
913
{
10-
private IMemoryCache? extendedSessions;
14+
IMemoryCache? extendedSessions;
1115

12-
internal IMemoryCache GetOrInitializeCache(double extendedSessionIdleTimeoutInSeconds)
16+
/// <summary>
17+
/// Gets the cache for extended sessions if it has already been initialized, or otherwise initializes it with the given expiration scan frequency.
18+
/// </summary>
19+
/// <param name="expirationScanFrequencyInSeconds">
20+
/// The expiration scan frequency of the cache, in seconds. T
21+
/// This specifies how often the cache checks for stale items, and evicts them.
22+
/// </param>
23+
/// <returns>The IMemoryCache that holds the cached <see cref="ExtendedSessionState"/>.</returns>
24+
internal IMemoryCache GetOrInitializeCache(double expirationScanFrequencyInSeconds)
1325
{
1426
this.extendedSessions ??= new MemoryCache(new MemoryCacheOptions
1527
{
16-
ExpirationScanFrequency = TimeSpan.FromSeconds(extendedSessionIdleTimeoutInSeconds),
28+
ExpirationScanFrequency = TimeSpan.FromSeconds(expirationScanFrequencyInSeconds),
1729
});
1830

1931
return this.extendedSessions;

0 commit comments

Comments
 (0)