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

use lib v5

parent 6d366fbd
......@@ -8,6 +8,7 @@
<PackageId>BasicTest</PackageId>
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
......
using StackExchange.Redis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System;
[assembly: AssemblyVersion("1.0.0")]
using System;
using System.Threading.Tasks;
using StackExchange.Redis;
namespace BasicTest
{
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");
db.StringIncrement("abc");
db.StringIncrement("abc", 15);
db.StringIncrement("abc");
int i = (int)db.StringGet("abc");
Console.WriteLine(i);
}
}
var batch = db.CreateBatch();
var del = batch.KeyDeleteAsync("abc");
var set = batch.StringSetAsync("abc", "Does SE.Redis work on System.IO.Pipelines?");
var s = batch.StringGetAsync("abc");
batch.Execute();
internal static string Me([CallerMemberName] string caller = null)
{
return caller;
await del;
await set;
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 @@
<clear/>
<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="Local" value="C:\Code\LocalNuget" />
</packageSources>
</configuration>
......@@ -31,6 +31,6 @@
<PackageReference Include="System.Memory" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Buffers" 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>
</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