Skip to content

Commit 8747636

Browse files
Added additional parameters to the redis caching provider
1 parent 2531243 commit 8747636

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/DotNetToolkit.Repository.Caching.Redis/RedisCacheProvider.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ public RedisCacheProvider([CanBeNull] TimeSpan? expiry)
3030
Expiry = expiry;
3131
}
3232

33+
/// <summary>
34+
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
35+
/// </summary>
36+
/// <param name="allowAdmin">Indicates whether admin operations should be allowed.</param>
37+
/// <param name="defaultDatabase">Specifies the default database to be used when calling ConnectionMultiplexer.GetDatabase() without any parameters.</param>
38+
/// <remarks>This will connect to a single server on the local machine using the default redis port (6379).</remarks>
39+
public RedisCacheProvider(bool allowAdmin, [CanBeNull] int? defaultDatabase) : this(allowAdmin, defaultDatabase, (TimeSpan?)null) { }
40+
3341
/// <summary>
3442
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
3543
/// </summary>
@@ -43,6 +51,12 @@ public RedisCacheProvider(bool allowAdmin, [CanBeNull] int? defaultDatabase, [Ca
4351
Expiry = expiry;
4452
}
4553

54+
/// <summary>
55+
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
56+
/// </summary>
57+
/// <param name="configuration">The string configuration to use for the redis multiplexer.</param>
58+
public RedisCacheProvider([NotNull] string configuration) : this(configuration, (TimeSpan?)null) { }
59+
4660
/// <summary>
4761
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
4862
/// </summary>
@@ -54,6 +68,12 @@ public RedisCacheProvider([NotNull] string configuration, [CanBeNull] TimeSpan?
5468
Expiry = expiry;
5569
}
5670

71+
/// <summary>
72+
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
73+
/// </summary>
74+
/// <param name="options">The configuration options to use for the redis multiplexer.</param>
75+
public RedisCacheProvider([NotNull] ConfigurationOptions options) : this(options, (TimeSpan?)null) { }
76+
5777
/// <summary>
5878
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
5979
/// </summary>
@@ -65,6 +85,15 @@ public RedisCacheProvider([NotNull] ConfigurationOptions options, [CanBeNull] Ti
6585
Expiry = expiry;
6686
}
6787

88+
/// <summary>
89+
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
90+
/// </summary>
91+
/// <param name="host">The host name.</param>
92+
/// <param name="ssl">Specifies that SSL encryption should be used.</param>
93+
/// <param name="allowAdmin">Indicates whether admin operations should be allowed.</param>
94+
/// <param name="defaultDatabase">Specifies the default database to be used when calling ConnectionMultiplexer.GetDatabase() without any parameters.</param>
95+
public RedisCacheProvider([NotNull] string host, bool ssl, bool allowAdmin, [CanBeNull] int? defaultDatabase) : this(host, ssl, allowAdmin, defaultDatabase, (TimeSpan?)null) { }
96+
6897
/// <summary>
6998
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
7099
/// </summary>
@@ -81,6 +110,17 @@ public RedisCacheProvider([NotNull] string host, bool ssl, bool allowAdmin, [Can
81110
Expiry = expiry;
82111
}
83112

113+
/// <summary>
114+
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
115+
/// </summary>
116+
/// <param name="host">The host name.</param>
117+
/// <param name="port">The port.</param>
118+
/// <param name="password">The password to use to authenticate with the server.</param>
119+
/// <param name="ssl">Specifies that SSL encryption should be used.</param>
120+
/// <param name="allowAdmin">Indicates whether admin operations should be allowed.</param>
121+
/// <param name="defaultDatabase">Specifies the default database to be used when calling ConnectionMultiplexer.GetDatabase() without any parameters.</param>
122+
public RedisCacheProvider([NotNull] string host, int port, [NotNull] string password, bool ssl, bool allowAdmin, [CanBeNull] int? defaultDatabase) : this(host, port, password, ssl, allowAdmin, defaultDatabase, (TimeSpan?)null) { }
123+
84124
/// <summary>
85125
/// Initializes a new instance of the <see cref="RedisCacheProvider" /> class.
86126
/// </summary>

0 commit comments

Comments
 (0)