File tree Expand file tree Collapse file tree
Example4.ShopCode/RefreshUsersClaims
ExamplesCommonCode/IdentityCookieCode
Test/UnitTests/TestCommonCode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,17 +9,17 @@ namespace Example4.ShopCode.RefreshUsersClaims;
99
1010/// <summary>
1111/// This service handles the reading and writing of a DateTime to a place that all instances of the application
12- /// Its uses <see cref="PoorMansGlobalCache "/> which uses a File - that works but a common cache like Redis would be perform better
12+ /// Its uses <see cref="GlobalFileStoreManager "/> which uses a File - that works but a common cache like Redis would be perform better
1313/// </summary>
1414public class GlobalChangeTimeService : IGlobalChangeTimeService
1515{
1616 private const string ChangedTimeFileName = "GlobalChangedTimeUtc" ;
1717
18- private readonly PoorMansGlobalCache _globalCache ;
18+ private readonly GlobalFileStoreManager _globalCache ;
1919
2020 public GlobalChangeTimeService ( IWebHostEnvironment environment )
2121 {
22- _globalCache = new PoorMansGlobalCache ( environment ) ;
22+ _globalCache = new GlobalFileStoreManager ( environment ) ;
2323 }
2424
2525 /// <summary>
Original file line number Diff line number Diff line change @@ -8,13 +8,12 @@ namespace ExamplesCommonCode.IdentityCookieCode;
88
99/// <summary>
1010/// This service handles the reading and writing of a a text file into a global directory shared by all instances of the application
11- /// I call this a "Poor Mans" version as it uses a text file.That works, but its slow compared to a Distributed Memory Cache or Redis
1211/// </summary>
13- public class PoorMansGlobalCache
12+ public class GlobalFileStoreManager
1413{
1514 private readonly string _webRootPath ;
1615
17- public PoorMansGlobalCache ( IWebHostEnvironment environment )
16+ public GlobalFileStoreManager ( IWebHostEnvironment environment )
1817 {
1918 _webRootPath = environment . WebRootPath ;
2019 }
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public static class PeriodicCookieEvent
2626 /// <summary>
2727 /// This method will be called on every HTTP request where a user is logged in (therefore you should keep the No change code quick)
2828 /// This method implements a way to update user's claims defined by a claim with the Type
29- /// <see cref="RefreshClaimsExtensions. TimeToRefreshUserClaimType"/>, which contains the time by which the refresh should occur.
29+ /// <see cref="TimeToRefreshUserClaimType"/>, which contains the time by which the refresh should occur.
3030 /// </summary>
3131 /// <param name="context"></param>
3232 public static async Task PeriodicRefreshUsersClaims ( CookieValidatePrincipalContext context )
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public void TestSetGlobalChangeTimeToNowUtc_And_GetGlobalChangeTimeUtc_NoFile()
2727 {
2828 //SETUP
2929 var stubEnv = new StubWebHostEnvironment { WebRootPath = TestData . GetTestDataDir ( ) } ;
30- var service = new PoorMansGlobalCache ( stubEnv ) ;
30+ var service = new GlobalFileStoreManager ( stubEnv ) ;
3131 service . Remove ( "Test" ) ;
3232
3333 //ATTEMPT
@@ -42,7 +42,7 @@ public void TestSetGlobalChangeTimeToNowUtc_And_GetGlobalChangeTimeUtc_ExistingF
4242 {
4343 //SETUP
4444 var stubEnv = new StubWebHostEnvironment { WebRootPath = TestData . GetTestDataDir ( ) } ;
45- var service = new PoorMansGlobalCache ( stubEnv ) ;
45+ var service = new GlobalFileStoreManager ( stubEnv ) ;
4646 var guid = Guid . NewGuid ( ) . ToString ( ) ;
4747
4848 //ATTEMPT
@@ -57,7 +57,7 @@ public void TestGetGlobalChangeTimeUtc_Performance_Exists()
5757 {
5858 //SETUP
5959 var stubEnv = new StubWebHostEnvironment { WebRootPath = TestData . GetTestDataDir ( ) } ;
60- var service = new PoorMansGlobalCache ( stubEnv ) ;
60+ var service = new GlobalFileStoreManager ( stubEnv ) ;
6161 service . Set ( "Test" , "hello" ) ;
6262
6363 //ATTEMPT
@@ -75,7 +75,7 @@ public void TestGetGlobalChangeTimeUtc_Performance_NoExists()
7575 {
7676 //SETUP
7777 var stubEnv = new StubWebHostEnvironment { WebRootPath = TestData . GetTestDataDir ( ) } ;
78- var service = new PoorMansGlobalCache ( stubEnv ) ;
78+ var service = new GlobalFileStoreManager ( stubEnv ) ;
7979 service . Remove ( "Test" ) ;
8080
8181 //ATTEMPT
You can’t perform that action at this time.
0 commit comments