Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 4fa0ceb

Browse files
committed
Upgrade to .NET 4.5 + add some C# 6 features
1 parent 0cdbd20 commit 4fa0ceb

File tree

5 files changed

+35
-90
lines changed

5 files changed

+35
-90
lines changed

NuGet.Signed/ServiceStack.Redis.Signed/servicestack.redis.signed.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
44
<id>ServiceStack.Redis.Signed</id>
55
<title>ServiceStack.Redis.Signed</title>
6-
<version>4.0.0</version>
6+
<version>4.5.0</version>
77
<authors>Service Stack</authors>
88
<owners>Service Stack</owners>
99
<description>
@@ -19,7 +19,7 @@
1919
<language>en-US</language>
2020
<copyright>ServiceStack 2013 and contributors</copyright>
2121
<dependencies>
22-
<dependency id="ServiceStack.Common.Signed" version="4.0" />
22+
<dependency id="ServiceStack.Common.Signed" version="4.5" />
2323
</dependencies>
2424
</metadata>
2525
<files>

NuGet/ServiceStack.Redis/servicestack.redis.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
44
<id>ServiceStack.Redis</id>
55
<title>C# Redis client for the Redis NoSQL DB</title>
6-
<version>4.0.0</version>
6+
<version>4.5.0</version>
77
<authors>Service Stack</authors>
88
<owners>Service Stack</owners>
99
<description>
@@ -21,7 +21,7 @@
2121
<language>en-US</language>
2222
<copyright>ServiceStack 2013 and contributors</copyright>
2323
<dependencies>
24-
<dependency id="ServiceStack.Common" version="4.0" />
24+
<dependency id="ServiceStack.Common" version="4.5" />
2525
</dependencies>
2626
</metadata>
2727
<files>

build/build-sn.proj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<PropertyGroup>
77
<MajorVersion Condition="$(MajorVersion) == ''">4</MajorVersion>
8-
<MinorVersion Condition="$(MinorVersion) == ''">0</MinorVersion>
8+
<MinorVersion Condition="$(MinorVersion) == ''">5</MinorVersion>
99
<PatchVersion Condition="$(PatchVersion) == ''">$(BUILD_NUMBER)</PatchVersion>
1010
</PropertyGroup>
1111

@@ -74,7 +74,7 @@
7474

7575
<!--Update Min Dependency Version -->
7676
<RegexTransform Include="$(NuGetPackageDir)/**/*.nuspec">
77-
<Find>version="4\.0[^"]*"</Find>
77+
<Find>version="4\.5[^"]*"</Find>
7878
<ReplaceWith>version="$(PackageVersion)"</ReplaceWith>
7979
</RegexTransform>
8080
</ItemGroup>
@@ -95,8 +95,8 @@
9595
<MSBuild Projects="$(BuildSolutionDir)/src/ServiceStack.Redis/ServiceStack.Redis.Signed.csproj"
9696
Targets="Build" Properties="Configuration=$(Configuration)" />
9797

98-
<MakeDir Directories="$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net40" Condition="!Exists('$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net40')" />
99-
<Copy SourceFiles="%(RedisFiles.Identity)" DestinationFolder="$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net40" />
98+
<MakeDir Directories="$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net45" Condition="!Exists('$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net45')" />
99+
<Copy SourceFiles="%(RedisFiles.Identity)" DestinationFolder="$(NuGetPackageDir)/ServiceStack.Redis.Signed/lib/net45" />
100100

101101
<Exec Command="&quot;$(NuGetPath)&quot; pack &quot;$(NuGetPackageDir)/ServiceStack.Redis.Signed/servicestack.redis.signed.nuspec&quot; -OutputDirectory &quot;$(NuGetPackageDir)&quot; -Version $(PackageVersion) -Symbols"
102102
LogStandardErrorAsError="true" />

build/build.proj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<PropertyGroup>
77
<MajorVersion Condition="$(MajorVersion) == ''">4</MajorVersion>
8-
<MinorVersion Condition="$(MinorVersion) == ''">0</MinorVersion>
8+
<MinorVersion Condition="$(MinorVersion) == ''">5</MinorVersion>
99
<PatchVersion Condition="$(PatchVersion) == ''">$(BUILD_NUMBER)</PatchVersion>
1010
</PropertyGroup>
1111

@@ -74,7 +74,7 @@
7474
</RegexTransform>
7575
<!--Update Min Dependency Version -->
7676
<RegexTransform Include="$(NuGetPackageDir)/**/*.nuspec">
77-
<Find>version="4\.0[^"]*"</Find>
77+
<Find>version="4\.5[^"]*"</Find>
7878
<ReplaceWith>version="$(PackageVersion)"</ReplaceWith>
7979
</RegexTransform>
8080
</ItemGroup>
@@ -96,8 +96,8 @@
9696
Targets="Build"
9797
Properties="Version=$(PackageVersion);Configuration=$(Configuration)" />
9898

99-
<MakeDir Directories="$(NuGetPackageDir)/ServiceStack.Redis/lib/net40" Condition="!Exists('$(NuGetPackageDir)/ServiceStack.Redis/lib/net40')" />
100-
<Copy SourceFiles="%(RedisFiles.Identity)" DestinationFolder="$(NuGetPackageDir)/ServiceStack.Redis/lib/net40" />
99+
<MakeDir Directories="$(NuGetPackageDir)/ServiceStack.Redis/lib/net45" Condition="!Exists('$(NuGetPackageDir)/ServiceStack.Redis/lib/net45')" />
100+
<Copy SourceFiles="%(RedisFiles.Identity)" DestinationFolder="$(NuGetPackageDir)/ServiceStack.Redis/lib/net45" />
101101

102102
<Exec Command="&quot;$(NuGetPath)&quot; pack &quot;$(NuGetPackageDir)/ServiceStack.Redis/servicestack.redis.nuspec&quot; -OutputDirectory &quot;$(NuGetPackageDir)&quot; -Version $(PackageVersion) -Symbols"
103103
LogStandardErrorAsError="true" />

src/ServiceStack.Redis/RedisClient.cs

Lines changed: 23 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using System.Collections.Generic;
1717
using System.Linq;
1818
using System.Text;
19-
using System.Threading;
2019
using ServiceStack.Redis.Generic;
2120
using ServiceStack.Redis.Pipeline;
2221
using ServiceStack.Text;
@@ -108,42 +107,36 @@ public RedisText Custom(params object[] cmdWithArgs)
108107
return ret;
109108
}
110109

111-
public DateTime ConvertToServerDate(DateTime expiresAt)
112-
{
113-
//placeholder if we ever try to compensate for differences in server-time
114-
return expiresAt;
115-
}
110+
public DateTime ConvertToServerDate(DateTime expiresAt) => expiresAt;
116111

117-
public string GetTypeSequenceKey<T>()
118-
{
119-
return String.Concat(NamespacePrefix, "seq:", typeof(T).Name);
120-
}
112+
public string GetTypeSequenceKey<T>() => string.Concat(NamespacePrefix, "seq:", typeof(T).Name);
121113

122-
public string GetTypeIdsSetKey<T>()
123-
{
124-
return String.Concat(NamespacePrefix, "ids:", typeof(T).Name);
125-
}
114+
public string GetTypeIdsSetKey<T>() => string.Concat(NamespacePrefix, "ids:", typeof(T).Name);
126115

127-
public string GetTypeIdsSetKey(Type type)
128-
{
129-
return String.Concat(NamespacePrefix, "ids:", type.Name);
130-
}
116+
public string GetTypeIdsSetKey(Type type) => string.Concat(NamespacePrefix, "ids:", type.Name);
131117

132-
public void RewriteAppendOnlyFileAsync()
133-
{
134-
base.BgRewriteAof();
135-
}
118+
public void RewriteAppendOnlyFileAsync() => base.BgRewriteAof();
136119

137-
public List<string> GetAllKeys()
138-
{
139-
return SearchKeys("*");
140-
}
120+
public List<string> GetAllKeys() => SearchKeys("*");
141121

142122
[Obsolete("Use SetValue()")]
143-
public void SetEntry(string key, string value)
144-
{
145-
SetValue(key, value);
146-
}
123+
public void SetEntry(string key, string value) => SetValue(key, value);
124+
[Obsolete("Use SetValue()")]
125+
public void SetEntry(string key, string value, TimeSpan expireIn) => SetValue(key, value, expireIn);
126+
[Obsolete("Use SetValueIfExists()")]
127+
public bool SetEntryIfExists(string key, string value) => SetValueIfExists(key, value);
128+
[Obsolete("Use SetValueIfNotExists()")]
129+
public bool SetEntryIfNotExists(string key, string value) => SetValueIfNotExists(key, value);
130+
[Obsolete("Use SetValueIfExists()")]
131+
public bool SetEntryIfExists(string key, string value, TimeSpan expireIn) => SetValueIfExists(key, value, expireIn);
132+
[Obsolete("Use SetValueIfNotExists()")]
133+
public bool SetEntryIfNotExists(string key, string value, TimeSpan expireIn) => SetValueIfNotExists(key, value, expireIn);
134+
[Obsolete("Use GetClientsInfo")]
135+
public List<Dictionary<string, string>> GetClientList() => GetClientsInfo();
136+
[Obsolete("Use GetValue()")]
137+
public string GetEntry(string key) => GetValue(key);
138+
[Obsolete("Use GetAndSetValue()")]
139+
public string GetAndSetEntry(string key, string value) => GetAndSetValue(key, value);
147140

148141
public void SetValue(string key, string value)
149142
{
@@ -168,12 +161,6 @@ public bool SetValue(byte[] key, byte[] value, TimeSpan expireIn)
168161
return true;
169162
}
170163

171-
[Obsolete("Use SetValue()")]
172-
public void SetEntry(string key, string value, TimeSpan expireIn)
173-
{
174-
SetValue(key, value, expireIn);
175-
}
176-
177164
public void SetValue(string key, string value, TimeSpan expireIn)
178165
{
179166
var bytesValue = value != null
@@ -193,38 +180,20 @@ public void SetValue(string key, string value, TimeSpan expireIn)
193180
}
194181
}
195182

196-
[Obsolete("Use SetValueIfExists()")]
197-
public bool SetEntryIfExists(string key, string value)
198-
{
199-
return SetValueIfExists(key, value);
200-
}
201-
202183
public bool SetValueIfExists(string key, string value)
203184
{
204185
var bytesValue = value != null ? value.ToUtf8Bytes() : null;
205186

206187
return base.Set(key, bytesValue, exists: true);
207188
}
208189

209-
[Obsolete("Use SetValueIfNotExists()")]
210-
public bool SetEntryIfNotExists(string key, string value)
211-
{
212-
return SetValueIfNotExists(key, value);
213-
}
214-
215190
public bool SetValueIfNotExists(string key, string value)
216191
{
217192
var bytesValue = value != null ? value.ToUtf8Bytes() : null;
218193

219194
return base.Set(key, bytesValue, exists: false);
220195
}
221196

222-
[Obsolete("Use SetValueIfExists()")]
223-
public bool SetEntryIfExists(string key, string value, TimeSpan expireIn)
224-
{
225-
return SetValueIfExists(key, value, expireIn);
226-
}
227-
228197
public bool SetValueIfExists(string key, string value, TimeSpan expireIn)
229198
{
230199
var bytesValue = value != null ? value.ToUtf8Bytes() : null;
@@ -235,12 +204,6 @@ public bool SetValueIfExists(string key, string value, TimeSpan expireIn)
235204
return base.Set(key, bytesValue, exists: true, expirySeconds: (int)expireIn.TotalSeconds);
236205
}
237206

238-
[Obsolete("Use SetValueIfNotExists()")]
239-
public bool SetEntryIfNotExists(string key, string value, TimeSpan expireIn)
240-
{
241-
return SetValueIfNotExists(key, value, expireIn);
242-
}
243-
244207
public bool SetValueIfNotExists(string key, string value, TimeSpan expireIn)
245208
{
246209
var bytesValue = value != null ? value.ToUtf8Bytes() : null;
@@ -251,12 +214,6 @@ public bool SetValueIfNotExists(string key, string value, TimeSpan expireIn)
251214
return base.Set(key, bytesValue, exists: false, expirySeconds: (int)expireIn.TotalSeconds);
252215
}
253216

254-
[Obsolete("Use GetClientsInfo")]
255-
public List<Dictionary<string, string>> GetClientList()
256-
{
257-
return GetClientsInfo();
258-
}
259-
260217
public void SetValues(Dictionary<string, string> map)
261218
{
262219
SetAll(map);
@@ -303,12 +260,6 @@ public void SetAll(Dictionary<string, string> map)
303260
base.MSet(keyBytes, valBytes);
304261
}
305262

306-
[Obsolete("Use GetValue()")]
307-
public string GetEntry(string key)
308-
{
309-
return GetValue(key);
310-
}
311-
312263
public string GetValue(string key)
313264
{
314265
var bytes = Get(key);
@@ -317,12 +268,6 @@ public string GetValue(string key)
317268
: bytes.FromUtf8Bytes();
318269
}
319270

320-
[Obsolete("Use GetAndSetValue()")]
321-
public string GetAndSetEntry(string key, string value)
322-
{
323-
return GetAndSetValue(key, value);
324-
}
325-
326271
public string GetAndSetValue(string key, string value)
327272
{
328273
return GetSet(key, value.ToUtf8Bytes()).FromUtf8Bytes();

0 commit comments

Comments
 (0)