You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// In a CQRS (Command Query Responsibility Segregation) architecture, MediatR is often used to dispatch commands (for state changes)
32
32
/// and queries (for data retrieval) to their respective handlers. This caching behavior is especially useful for queries, as it can
33
-
/// intercept query requests, check if the result is already cached, and return the cached data if available—reducing load on the system
33
+
/// intercept query requests, check if the result is already cached, and return the cached data if available�reducing load on the system
34
34
/// and improving performance. For commands, which change state, caching is typically bypassed. This ensures that queries are fast and
35
35
/// scalable, while commands remain consistent and reliable, fully supporting the separation of read and write concerns central to CQRS.
36
36
/// </summary>
@@ -41,6 +41,13 @@ IDistributedCache cache
41
41
:IPipelineBehavior<TRequest,TResponse>
42
42
whereTRequest:ICacheable
43
43
{
44
+
/// <summary>
45
+
/// Intercepts cacheable requests to return a cached response when available or invoke the handler, cache its result, and return that response.
46
+
/// </summary>
47
+
/// <param name="request">The cacheable request that provides the cache key and controls behavior (set BypassCache to skip caching; may specify SlidingExpirationInMinutes and AbsoluteExpirationInMinutes).</param>
48
+
/// <param name="next">The handler delegate to execute when a cached response is not available or caching is bypassed.</param>
49
+
/// <param name="cancellationToken">Cancellation token used for cache operations and handler execution.</param>
50
+
/// <returns>The cached response if present for the request's CacheKey; otherwise the response produced by invoking the handler.</returns>
Copy file name to clipboardExpand all lines: Core/Application/Common/DTOs/TokenBlacklistStatusDto.cs
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,14 @@ public class TokenBlacklistStatusDto
48
48
49
49
/// <summary>
50
50
/// Creates a blacklisted token status.
51
+
/// <summary>
52
+
/// Create a TokenBlacklistStatusDto representing a token that has been blacklisted.
51
53
/// </summary>
54
+
/// <param name="tokenId">The token's JWT ID (jti), or null if unknown.</param>
55
+
/// <param name="blacklistedAt">The UTC time when the token was blacklisted, or null if not recorded.</param>
56
+
/// <param name="tokenExpiresAt">The token's natural expiration time, or null if unknown.</param>
57
+
/// <param name="fromCache">Whether the status was retrieved from cache.</param>
58
+
/// <returns>A TokenBlacklistStatusDto with IsBlacklisted set to `true`, Status set to "blacklisted", Details describing the blacklist, CheckedAt set to the current UTC time, and FromCache set to the provided value.</returns>
52
59
publicstaticTokenBlacklistStatusDtoBlacklisted(
53
60
string?tokenId,
54
61
DateTime?blacklistedAt,
@@ -70,7 +77,13 @@ public static TokenBlacklistStatusDto Blacklisted(
70
77
71
78
/// <summary>
72
79
/// Creates a valid (not blacklisted) token status.
80
+
/// <summary>
81
+
/// Creates a TokenBlacklistStatusDto representing a valid (not blacklisted) token.
73
82
/// </summary>
83
+
/// <param name="tokenId">The token's JWT ID (jti), or null if unavailable.</param>
84
+
/// <param name="tokenExpiresAt">The token's natural expiration time, or null if unknown.</param>
85
+
/// <param name="fromCache">Whether the result was retrieved from cache.</param>
86
+
/// <returns>A DTO indicating the token is valid; CheckedAt is set to the current UTC time.</returns>
74
87
publicstaticTokenBlacklistStatusDtoValid(
75
88
string?tokenId,
76
89
DateTime?tokenExpiresAt,
@@ -90,7 +103,11 @@ public static TokenBlacklistStatusDto Valid(
90
103
91
104
/// <summary>
92
105
/// Creates an invalid token status (malformed or expired).
106
+
/// <summary>
107
+
/// Create a TokenBlacklistStatusDto representing an invalid token status.
93
108
/// </summary>
109
+
/// <param name="reason">Human-readable explanation for why the token is considered invalid.</param>
110
+
/// <returns>A TokenBlacklistStatusDto with IsBlacklisted set to false, Status set to "invalid", Details set to the provided reason, CheckedAt set to the current UTC time, and FromCache set to false.</returns>
0 commit comments