Commit 7c709ecf authored by Marc Gravell's avatar Marc Gravell

use lib v5

parent 6d366fbd
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<PackageId>BasicTest</PackageId> <PackageId>BasicTest</PackageId>
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
using StackExchange.Redis; using System;
using System.Reflection; using System.Threading.Tasks;
using System.Runtime.CompilerServices; using StackExchange.Redis;
using System;
[assembly: AssemblyVersion("1.0.0")]
namespace BasicTest namespace BasicTest
{ {
internal static class Program internal static class Program
{ {
public static void Main() public static async Task Main()
{ {
using (var conn = ConnectionMultiplexer.Connect("127.0.0.1:6379")) using (var conn = await ConnectionMultiplexer.ConnectAsync("127.0.0.1:6379"))
{ {
var db = conn.GetDatabase(); var db = conn.GetDatabase(3);
db.KeyDelete("abc"); var batch = db.CreateBatch();
db.StringIncrement("abc"); var del = batch.KeyDeleteAsync("abc");
db.StringIncrement("abc", 15); var set = batch.StringSetAsync("abc", "Does SE.Redis work on System.IO.Pipelines?");
db.StringIncrement("abc"); var s = batch.StringGetAsync("abc");
int i = (int)db.StringGet("abc"); batch.Execute();
Console.WriteLine(i);
}
}
internal static string Me([CallerMemberName] string caller = null) await del;
{ await set;
return caller; Console.WriteLine(await s);
var rand = new Random(12345);
RedisKey counter = "counter";
db.KeyDelete(counter, CommandFlags.FireAndForget);
int expected = 0;
for (int i = 0; i < 1000; i++)
{
int x = rand.Next(50);
expected += x;
db.StringIncrement(counter, x, CommandFlags.FireAndForget);
}
int actual = (int)db.StringGet(counter);
Console.WriteLine($"{expected} vs {actual}");
}
} }
} }
} }
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
<clear/> <clear/>
<add key="xUnit" value="https://www.myget.org/F/xunit/api/v3/index.json" /> <add key="xUnit" value="https://www.myget.org/F/xunit/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" /> <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Local" value="C:\Code\LocalNuget" />
</packageSources> </packageSources>
</configuration> </configuration>
...@@ -31,6 +31,6 @@ ...@@ -31,6 +31,6 @@
<PackageReference Include="System.Memory" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Memory" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Buffers" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Buffers" Version="$(CoreFxVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxVersion)" /> <PackageReference Include="System.IO.Pipelines" Version="$(CoreFxVersion)" />
<PackageReference Include="Pipelines.Sockets.Unofficial" Version="0.2.0-alpha-004" /> <PackageReference Include="Pipelines.Sockets.Unofficial" Version="0.2.0-alpha-005" />
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment