forked from ssdb/dotnetssdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
executable file
·59 lines (52 loc) · 1.67 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ssdb
{
class Program
{
static void Main(string[] args) {
Client client = new Client("127.0.0.1", 8888);
List<byte[]> resp = client.request("set", "a", "100");
foreach(byte[] bs in resp) {
Console.WriteLine(Encoding.Default.GetString(bs));
}
resp = client.request("get", "a");
foreach(byte[] bs in resp) {
Console.WriteLine(Encoding.Default.GetString(bs));
}
client.set("a", "99");
string val;
client.get("a", out val);
Console.WriteLine(val);
Console.WriteLine("-----------------");
{
KeyValuePair<string, byte[]>[] kvs = client.scan("", "", 3);
Console.WriteLine(kvs.Length + " kvs");
foreach(KeyValuePair<string, byte[]> kv in kvs) {
Console.WriteLine(" " + kv.Key + ": " + Encoding.Default.GetString(kv.Value));
}
}
Console.WriteLine("-----------------");
{
KeyValuePair<string, Int64>[] kvs = client.zscan("z", "", Int64.MinValue, Int64.MaxValue, 3);
Console.WriteLine(kvs.Length + " kvs");
foreach(KeyValuePair<string, Int64> kv in kvs) {
Console.WriteLine(" " + kv.Key + ": " + kv.Value);
}
}
Console.WriteLine("-----------------");
{
KeyValuePair<string, Int64>[] kvs = client.zrscan("z", "", Int64.MaxValue, Int64.MinValue, 3);
Console.WriteLine(kvs.Length + " kvs");
foreach(KeyValuePair<string, Int64> kv in kvs) {
Console.WriteLine(" " + kv.Key + ": " + kv.Value);
}
}
Console.WriteLine(client.zsize("z").ToString());
Console.ReadLine();
client.close();
}
}
}