-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
131 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Shiny.Mediator.Infrastructure; | ||
|
||
namespace Shiny.Mediator; | ||
|
||
public static class Headers | ||
{ | ||
const string TimerRefreshHeader = nameof(TimerRefreshHeader); | ||
public static (string Key, int Value) TimerRefresh(int timerRefreshSeconds) | ||
=> (TimerRefreshHeader, timerRefreshSeconds); | ||
|
||
public static int? TryGetTimerRefresh(this RequestContext context) | ||
=> context.TryGetValue<int>(TimerRefreshHeader); | ||
|
||
|
||
const string CommandScheduleHeader = nameof(CommandScheduleHeader); | ||
public static (string Key, object Value) SetCommandSchedule(DateTimeOffset dueAt) | ||
=> (CommandScheduleHeader, dueAt); | ||
|
||
public static DateTimeOffset? TryGetCommandSchedule(this CommandContext context) | ||
=> context.TryGetValue<DateTimeOffset>(CommandScheduleHeader); | ||
|
||
#region Caching | ||
|
||
const string CacheConfigHeader = nameof(CacheConfigHeader); | ||
public static CacheItemConfig? TryGetCacheConfig(this RequestContext context) | ||
=> context.TryGetValue<CacheItemConfig>(CacheConfigHeader); | ||
|
||
public static (string Key, object Value) SetCacheConfig(this RequestContext context, CacheItemConfig cfg) | ||
=> (CacheConfigHeader, cfg); | ||
|
||
|
||
const string ForceCacheRefreshHeader = nameof(ForceCacheRefreshHeader); | ||
public static (string Key, bool Value) ForceCacheRefresh { get; } = (ForceCacheRefreshHeader, true); | ||
|
||
public static bool HasForceCacheRefresh(this RequestContext context) | ||
=> context.Values.ContainsKey(ForceCacheRefreshHeader); | ||
|
||
#endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters