forked from brthor/Gofer.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IBackend.cs
56 lines (33 loc) · 1.64 KB
/
IBackend.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
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using StackExchange.Redis;
namespace Gofer.NET
{
public interface IBackend
{
Task Enqueue(string queueKey, string jsonString);
Task<string> Dequeue(string queueKey);
Task<IEnumerable<string>> DequeueBatch(string queueKey, int batchSize=100);
Task<IBackendLock> LockBlocking(string lockKey);
Task<IBackendLock> LockNonBlocking(string lockKey);
Task SetString(string key, string value);
Task<string> GetString(string key);
Task<IEnumerable<string>> GetStrings(IEnumerable<string> key);
Task<ISet<string>> GetSet(string key);
Task AddToSet(string key, string value);
Task RemoveFromSet(string key, string value);
Task<IEnumerable<string>> GetList(string key);
Task<long> AddToList(string key, string value);
Task<long> RemoveFromList(string key, string value);
Task DeleteKey(string key);
Task<LoadedLuaScript> LoadLuaScript(string scriptContents);
Task<RedisResult> RunLuaScript(LoadedLuaScript script, RedisKey[] keys, RedisValue[] values);
Task AddToOrderedSet(string setKey, long score, string value);
Task<bool> RemoveFromOrderedSet(string setKey, string value);
Task SetMapField(string mapKey, string mapField, RedisValue value);
Task SetMapFields(string mapKey, params (RedisValue, RedisValue)[] mapFieldValuePairs);
Task<bool> DeleteMapFields(string mapKey, params RedisValue[] mapFields);
Task<RedisValue> GetMapField(string mapKey, string mapField);
}
}