-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
be56169
commit e6c5343
Showing
16 changed files
with
94 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RCommon.ApplicationServices | ||
{ | ||
public class CqrsCachingOptions | ||
{ | ||
public CqrsCachingOptions() | ||
{ | ||
this.UseCacheForHandlers = false; | ||
} | ||
|
||
public bool UseCacheForHandlers { get; set; } | ||
} | ||
} |
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,42 @@ | ||
using RCommon.Caching; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RCommon.ApplicationServices | ||
{ | ||
public static class ICqrsBuilderExtensions | ||
{ | ||
public static ICqrsBuilder AddMemoryCachingForHandlers<T>(this ICqrsBuilder builder) | ||
where T : IMemoryCachingBuilder | ||
{ | ||
return AddMemoryCachingForHandlers<T>(builder, x => { }); | ||
} | ||
|
||
public static ICqrsBuilder AddMemoryCachingForHandlers<T>(this ICqrsBuilder builder, Action<T> actions) | ||
where T : IMemoryCachingBuilder | ||
{ | ||
Guard.IsNotNull(actions, nameof(actions)); | ||
var cachingConfig = (T)Activator.CreateInstance(typeof(T), new object[] { builder }); | ||
actions(cachingConfig); | ||
return builder; | ||
} | ||
|
||
public static ICqrsBuilder AddDistributedCachingForHandlers<T>(this ICqrsBuilder builder) | ||
where T : IDistributedCachingBuilder | ||
{ | ||
return AddDistributedCachingForHandlers<T>(builder, x => { }); | ||
} | ||
|
||
public static ICqrsBuilder AddDistributedCachingForHandlers<T>(this ICqrsBuilder builder, Action<T> actions) | ||
where T : IDistributedCachingBuilder | ||
{ | ||
Guard.IsNotNull(actions, nameof(actions)); | ||
var cachingConfig = (T)Activator.CreateInstance(typeof(T), new object[] { builder }); | ||
actions(cachingConfig); | ||
return builder; | ||
} | ||
} | ||
} |
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
8 changes: 3 additions & 5 deletions
8
Src/RCommon.Persistence.Caching/RCommon.Persistence.Caching.csproj
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