初始化
This commit is contained in:
14
Faster/Faster.csproj
Normal file
14
Faster/Faster.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.FASTER.Core" Version="2.6.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
28
Faster/Program.cs
Normal file
28
Faster/Program.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using FASTER.core;
|
||||
|
||||
namespace Faster
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
using var settings = new FasterKVSettings<long, long>("c:/temp"); // backing storage device
|
||||
using var store = new FasterKV<long, long>(settings);
|
||||
|
||||
// Create a session per sequence of interactions with FASTER
|
||||
// We use default callback functions with a custom merger: RMW merges input by adding it to value
|
||||
using var session = store.NewSession(new SimpleFunctions<long, long>((a, b) => a + b));
|
||||
|
||||
long key = 1, value = 1, input = 10, output = 0;
|
||||
|
||||
// Upsert and Read
|
||||
session.Upsert(ref key, ref value);
|
||||
session.Read(ref key, ref output);
|
||||
|
||||
// Read-Modify-Write (add input to value)
|
||||
session.RMW(ref key, ref input);
|
||||
session.RMW(ref key, ref input, ref output);
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user