Skip to content

Commit 6366524

Browse files
committed
RedisChannel creation API
1 parent 1b763ca commit 6366524

5 files changed

Lines changed: 325 additions & 103 deletions

File tree

src/StackExchange.Redis/KeyNotificationType.cs

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,54 @@ public enum KeyNotificationType
1010
#pragma warning disable CS1591 // docs, redundant
1111
Unknown = 0,
1212
Append = 1,
13-
Copy = 1,
14-
Del = 2,
15-
Expire = 3,
16-
HDel = 4,
17-
HExpired = 5,
18-
HIncrByFloat = 6,
19-
HIncrBy = 7,
20-
HPersist = 8,
21-
HSet = 9,
22-
IncrByFloat = 10,
23-
IncrBy = 11,
24-
LInsert = 12,
25-
LPop = 13,
26-
LPush = 14,
27-
LRem = 15,
28-
LSet = 16,
29-
LTrim = 17,
30-
MoveFrom = 18,
31-
MoveTo = 19,
32-
Persist = 20,
33-
RenameFrom = 21,
34-
RenameTo = 22,
35-
Restore = 23,
36-
RPop = 24,
37-
RPush = 25,
38-
SAdd = 26,
39-
Set = 27,
40-
SetRange = 28,
41-
SortStore = 29,
42-
SRem = 30,
43-
SPop = 31,
44-
XAdd = 32,
45-
XDel = 33,
46-
XGroupCreateConsumer = 34,
47-
XGroupCreate = 35,
48-
XGroupDelConsumer = 36,
49-
XGroupDestroy = 37,
50-
XGroupSetId = 38,
51-
XSetId = 39,
52-
XTrim = 40,
53-
ZAdd = 41,
54-
ZDiffStore = 42,
55-
ZInterStore = 43,
56-
ZUnionStore = 44,
57-
ZIncr = 45,
58-
ZRemByRank = 46,
59-
ZRemByScore = 47,
60-
ZRem = 48,
13+
Copy = 2,
14+
Del = 3,
15+
Expire = 4,
16+
HDel = 5,
17+
HExpired = 6,
18+
HIncrByFloat = 7,
19+
HIncrBy = 8,
20+
HPersist = 9,
21+
HSet = 10,
22+
IncrByFloat = 11,
23+
IncrBy = 12,
24+
LInsert = 13,
25+
LPop = 14,
26+
LPush = 15,
27+
LRem = 16,
28+
LSet = 17,
29+
LTrim = 18,
30+
MoveFrom = 19,
31+
MoveTo = 20,
32+
Persist = 21,
33+
RenameFrom = 22,
34+
RenameTo = 23,
35+
Restore = 24,
36+
RPop = 25,
37+
RPush = 26,
38+
SAdd = 27,
39+
Set = 28,
40+
SetRange = 29,
41+
SortStore = 30,
42+
SRem = 31,
43+
SPop = 32,
44+
XAdd = 33,
45+
XDel = 34,
46+
XGroupCreateConsumer = 35,
47+
XGroupCreate = 36,
48+
XGroupDelConsumer = 37,
49+
XGroupDestroy = 38,
50+
XGroupSetId = 39,
51+
XSetId = 40,
52+
XTrim = 41,
53+
ZAdd = 42,
54+
ZDiffStore = 43,
55+
ZInterStore = 44,
56+
ZUnionStore = 45,
57+
ZIncr = 46,
58+
ZRemByRank = 47,
59+
ZRemByScore = 48,
60+
ZRem = 49,
6161

6262
// side-effect notifications
6363
Expired = 1000,

src/StackExchange.Redis/KeyNotificationTypeFastHash.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,67 @@ internal static partial class type_changed
346346

347347
// ReSharper restore InconsistentNaming
348348
#pragma warning restore SA1300, CS8981
349+
350+
internal static ReadOnlySpan<byte> GetRawBytes(KeyNotificationType type)
351+
{
352+
return type switch
353+
{
354+
KeyNotificationType.Append => append.U8,
355+
KeyNotificationType.Copy => copy.U8,
356+
KeyNotificationType.Del => del.U8,
357+
KeyNotificationType.Expire => expire.U8,
358+
KeyNotificationType.HDel => hdel.U8,
359+
KeyNotificationType.HExpired => hexpired.U8,
360+
KeyNotificationType.HIncrByFloat => hincrbyfloat.U8,
361+
KeyNotificationType.HIncrBy => hincrby.U8,
362+
KeyNotificationType.HPersist => hpersist.U8,
363+
KeyNotificationType.HSet => hset.U8,
364+
KeyNotificationType.IncrByFloat => incrbyfloat.U8,
365+
KeyNotificationType.IncrBy => incrby.U8,
366+
KeyNotificationType.LInsert => linsert.U8,
367+
KeyNotificationType.LPop => lpop.U8,
368+
KeyNotificationType.LPush => lpush.U8,
369+
KeyNotificationType.LRem => lrem.U8,
370+
KeyNotificationType.LSet => lset.U8,
371+
KeyNotificationType.LTrim => ltrim.U8,
372+
KeyNotificationType.MoveFrom => move_from.U8,
373+
KeyNotificationType.MoveTo => move_to.U8,
374+
KeyNotificationType.Persist => persist.U8,
375+
KeyNotificationType.RenameFrom => rename_from.U8,
376+
KeyNotificationType.RenameTo => rename_to.U8,
377+
KeyNotificationType.Restore => restore.U8,
378+
KeyNotificationType.RPop => rpop.U8,
379+
KeyNotificationType.RPush => rpush.U8,
380+
KeyNotificationType.SAdd => sadd.U8,
381+
KeyNotificationType.Set => set.U8,
382+
KeyNotificationType.SetRange => setrange.U8,
383+
KeyNotificationType.SortStore => sortstore.U8,
384+
KeyNotificationType.SRem => srem.U8,
385+
KeyNotificationType.SPop => spop.U8,
386+
KeyNotificationType.XAdd => xadd.U8,
387+
KeyNotificationType.XDel => xdel.U8,
388+
KeyNotificationType.XGroupCreateConsumer => xgroup_createconsumer.U8,
389+
KeyNotificationType.XGroupCreate => xgroup_create.U8,
390+
KeyNotificationType.XGroupDelConsumer => xgroup_delconsumer.U8,
391+
KeyNotificationType.XGroupDestroy => xgroup_destroy.U8,
392+
KeyNotificationType.XGroupSetId => xgroup_setid.U8,
393+
KeyNotificationType.XSetId => xsetid.U8,
394+
KeyNotificationType.XTrim => xtrim.U8,
395+
KeyNotificationType.ZAdd => zadd.U8,
396+
KeyNotificationType.ZDiffStore => zdiffstore.U8,
397+
KeyNotificationType.ZInterStore => zinterstore.U8,
398+
KeyNotificationType.ZUnionStore => zunionstore.U8,
399+
KeyNotificationType.ZIncr => zincr.U8,
400+
KeyNotificationType.ZRemByRank => zrembyrank.U8,
401+
KeyNotificationType.ZRemByScore => zrembyscore.U8,
402+
KeyNotificationType.ZRem => zrem.U8,
403+
KeyNotificationType.Expired => expired.U8,
404+
KeyNotificationType.Evicted => evicted.U8,
405+
KeyNotificationType.New => _new.U8,
406+
KeyNotificationType.Overwritten => overwritten.U8,
407+
KeyNotificationType.TypeChanged => type_changed.U8,
408+
_ => Throw(),
409+
};
410+
static ReadOnlySpan<byte> Throw() => throw new ArgumentOutOfRangeException(nameof(type));
411+
}
349412
}

src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt

Lines changed: 51 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,62 @@ StackExchange.Redis.KeyNotification.TryCopyKey(System.Span<byte> destination, ou
1212
StackExchange.Redis.KeyNotification.Type.get -> StackExchange.Redis.KeyNotificationType
1313
static StackExchange.Redis.KeyNotification.TryParse(in StackExchange.Redis.RedisChannel channel, in StackExchange.Redis.RedisValue value, out StackExchange.Redis.KeyNotification notification) -> bool
1414
StackExchange.Redis.ChannelMessage.TryParseKeyNotification(out StackExchange.Redis.KeyNotification notification) -> bool
15+
static StackExchange.Redis.RedisChannel.KeyEvent(StackExchange.Redis.KeyNotificationType type, int? database = null) -> StackExchange.Redis.RedisChannel
16+
static StackExchange.Redis.RedisChannel.KeySpace(in StackExchange.Redis.RedisKey key, int database) -> StackExchange.Redis.RedisChannel
17+
static StackExchange.Redis.RedisChannel.KeySpacePattern(in StackExchange.Redis.RedisKey pattern, int? database = null) -> StackExchange.Redis.RedisChannel
1518
StackExchange.Redis.KeyNotificationType
1619
StackExchange.Redis.KeyNotificationType.Append = 1 -> StackExchange.Redis.KeyNotificationType
17-
StackExchange.Redis.KeyNotificationType.Copy = 1 -> StackExchange.Redis.KeyNotificationType
18-
StackExchange.Redis.KeyNotificationType.Del = 2 -> StackExchange.Redis.KeyNotificationType
20+
StackExchange.Redis.KeyNotificationType.Copy = 2 -> StackExchange.Redis.KeyNotificationType
21+
StackExchange.Redis.KeyNotificationType.Del = 3 -> StackExchange.Redis.KeyNotificationType
1922
StackExchange.Redis.KeyNotificationType.Evicted = 1001 -> StackExchange.Redis.KeyNotificationType
20-
StackExchange.Redis.KeyNotificationType.Expire = 3 -> StackExchange.Redis.KeyNotificationType
23+
StackExchange.Redis.KeyNotificationType.Expire = 4 -> StackExchange.Redis.KeyNotificationType
2124
StackExchange.Redis.KeyNotificationType.Expired = 1000 -> StackExchange.Redis.KeyNotificationType
22-
StackExchange.Redis.KeyNotificationType.HDel = 4 -> StackExchange.Redis.KeyNotificationType
23-
StackExchange.Redis.KeyNotificationType.HExpired = 5 -> StackExchange.Redis.KeyNotificationType
24-
StackExchange.Redis.KeyNotificationType.HIncrBy = 7 -> StackExchange.Redis.KeyNotificationType
25-
StackExchange.Redis.KeyNotificationType.HIncrByFloat = 6 -> StackExchange.Redis.KeyNotificationType
26-
StackExchange.Redis.KeyNotificationType.HPersist = 8 -> StackExchange.Redis.KeyNotificationType
27-
StackExchange.Redis.KeyNotificationType.HSet = 9 -> StackExchange.Redis.KeyNotificationType
28-
StackExchange.Redis.KeyNotificationType.IncrBy = 11 -> StackExchange.Redis.KeyNotificationType
29-
StackExchange.Redis.KeyNotificationType.IncrByFloat = 10 -> StackExchange.Redis.KeyNotificationType
30-
StackExchange.Redis.KeyNotificationType.LInsert = 12 -> StackExchange.Redis.KeyNotificationType
31-
StackExchange.Redis.KeyNotificationType.LPop = 13 -> StackExchange.Redis.KeyNotificationType
32-
StackExchange.Redis.KeyNotificationType.LPush = 14 -> StackExchange.Redis.KeyNotificationType
33-
StackExchange.Redis.KeyNotificationType.LRem = 15 -> StackExchange.Redis.KeyNotificationType
34-
StackExchange.Redis.KeyNotificationType.LSet = 16 -> StackExchange.Redis.KeyNotificationType
35-
StackExchange.Redis.KeyNotificationType.LTrim = 17 -> StackExchange.Redis.KeyNotificationType
36-
StackExchange.Redis.KeyNotificationType.MoveFrom = 18 -> StackExchange.Redis.KeyNotificationType
37-
StackExchange.Redis.KeyNotificationType.MoveTo = 19 -> StackExchange.Redis.KeyNotificationType
25+
StackExchange.Redis.KeyNotificationType.HDel = 5 -> StackExchange.Redis.KeyNotificationType
26+
StackExchange.Redis.KeyNotificationType.HExpired = 6 -> StackExchange.Redis.KeyNotificationType
27+
StackExchange.Redis.KeyNotificationType.HIncrBy = 8 -> StackExchange.Redis.KeyNotificationType
28+
StackExchange.Redis.KeyNotificationType.HIncrByFloat = 7 -> StackExchange.Redis.KeyNotificationType
29+
StackExchange.Redis.KeyNotificationType.HPersist = 9 -> StackExchange.Redis.KeyNotificationType
30+
StackExchange.Redis.KeyNotificationType.HSet = 10 -> StackExchange.Redis.KeyNotificationType
31+
StackExchange.Redis.KeyNotificationType.IncrBy = 12 -> StackExchange.Redis.KeyNotificationType
32+
StackExchange.Redis.KeyNotificationType.IncrByFloat = 11 -> StackExchange.Redis.KeyNotificationType
33+
StackExchange.Redis.KeyNotificationType.LInsert = 13 -> StackExchange.Redis.KeyNotificationType
34+
StackExchange.Redis.KeyNotificationType.LPop = 14 -> StackExchange.Redis.KeyNotificationType
35+
StackExchange.Redis.KeyNotificationType.LPush = 15 -> StackExchange.Redis.KeyNotificationType
36+
StackExchange.Redis.KeyNotificationType.LRem = 16 -> StackExchange.Redis.KeyNotificationType
37+
StackExchange.Redis.KeyNotificationType.LSet = 17 -> StackExchange.Redis.KeyNotificationType
38+
StackExchange.Redis.KeyNotificationType.LTrim = 18 -> StackExchange.Redis.KeyNotificationType
39+
StackExchange.Redis.KeyNotificationType.MoveFrom = 19 -> StackExchange.Redis.KeyNotificationType
40+
StackExchange.Redis.KeyNotificationType.MoveTo = 20 -> StackExchange.Redis.KeyNotificationType
3841
StackExchange.Redis.KeyNotificationType.New = 1002 -> StackExchange.Redis.KeyNotificationType
3942
StackExchange.Redis.KeyNotificationType.Overwritten = 1003 -> StackExchange.Redis.KeyNotificationType
40-
StackExchange.Redis.KeyNotificationType.Persist = 20 -> StackExchange.Redis.KeyNotificationType
41-
StackExchange.Redis.KeyNotificationType.RenameFrom = 21 -> StackExchange.Redis.KeyNotificationType
42-
StackExchange.Redis.KeyNotificationType.RenameTo = 22 -> StackExchange.Redis.KeyNotificationType
43-
StackExchange.Redis.KeyNotificationType.Restore = 23 -> StackExchange.Redis.KeyNotificationType
44-
StackExchange.Redis.KeyNotificationType.RPop = 24 -> StackExchange.Redis.KeyNotificationType
45-
StackExchange.Redis.KeyNotificationType.RPush = 25 -> StackExchange.Redis.KeyNotificationType
46-
StackExchange.Redis.KeyNotificationType.SAdd = 26 -> StackExchange.Redis.KeyNotificationType
47-
StackExchange.Redis.KeyNotificationType.Set = 27 -> StackExchange.Redis.KeyNotificationType
48-
StackExchange.Redis.KeyNotificationType.SetRange = 28 -> StackExchange.Redis.KeyNotificationType
49-
StackExchange.Redis.KeyNotificationType.SortStore = 29 -> StackExchange.Redis.KeyNotificationType
50-
StackExchange.Redis.KeyNotificationType.SPop = 31 -> StackExchange.Redis.KeyNotificationType
51-
StackExchange.Redis.KeyNotificationType.SRem = 30 -> StackExchange.Redis.KeyNotificationType
43+
StackExchange.Redis.KeyNotificationType.Persist = 21 -> StackExchange.Redis.KeyNotificationType
44+
StackExchange.Redis.KeyNotificationType.RenameFrom = 22 -> StackExchange.Redis.KeyNotificationType
45+
StackExchange.Redis.KeyNotificationType.RenameTo = 23 -> StackExchange.Redis.KeyNotificationType
46+
StackExchange.Redis.KeyNotificationType.Restore = 24 -> StackExchange.Redis.KeyNotificationType
47+
StackExchange.Redis.KeyNotificationType.RPop = 25 -> StackExchange.Redis.KeyNotificationType
48+
StackExchange.Redis.KeyNotificationType.RPush = 26 -> StackExchange.Redis.KeyNotificationType
49+
StackExchange.Redis.KeyNotificationType.SAdd = 27 -> StackExchange.Redis.KeyNotificationType
50+
StackExchange.Redis.KeyNotificationType.Set = 28 -> StackExchange.Redis.KeyNotificationType
51+
StackExchange.Redis.KeyNotificationType.SetRange = 29 -> StackExchange.Redis.KeyNotificationType
52+
StackExchange.Redis.KeyNotificationType.SortStore = 30 -> StackExchange.Redis.KeyNotificationType
53+
StackExchange.Redis.KeyNotificationType.SPop = 32 -> StackExchange.Redis.KeyNotificationType
54+
StackExchange.Redis.KeyNotificationType.SRem = 31 -> StackExchange.Redis.KeyNotificationType
5255
StackExchange.Redis.KeyNotificationType.TypeChanged = 1004 -> StackExchange.Redis.KeyNotificationType
5356
StackExchange.Redis.KeyNotificationType.Unknown = 0 -> StackExchange.Redis.KeyNotificationType
54-
StackExchange.Redis.KeyNotificationType.XAdd = 32 -> StackExchange.Redis.KeyNotificationType
55-
StackExchange.Redis.KeyNotificationType.XDel = 33 -> StackExchange.Redis.KeyNotificationType
56-
StackExchange.Redis.KeyNotificationType.XGroupCreate = 35 -> StackExchange.Redis.KeyNotificationType
57-
StackExchange.Redis.KeyNotificationType.XGroupCreateConsumer = 34 -> StackExchange.Redis.KeyNotificationType
58-
StackExchange.Redis.KeyNotificationType.XGroupDelConsumer = 36 -> StackExchange.Redis.KeyNotificationType
59-
StackExchange.Redis.KeyNotificationType.XGroupDestroy = 37 -> StackExchange.Redis.KeyNotificationType
60-
StackExchange.Redis.KeyNotificationType.XGroupSetId = 38 -> StackExchange.Redis.KeyNotificationType
61-
StackExchange.Redis.KeyNotificationType.XSetId = 39 -> StackExchange.Redis.KeyNotificationType
62-
StackExchange.Redis.KeyNotificationType.XTrim = 40 -> StackExchange.Redis.KeyNotificationType
63-
StackExchange.Redis.KeyNotificationType.ZAdd = 41 -> StackExchange.Redis.KeyNotificationType
64-
StackExchange.Redis.KeyNotificationType.ZDiffStore = 42 -> StackExchange.Redis.KeyNotificationType
65-
StackExchange.Redis.KeyNotificationType.ZIncr = 45 -> StackExchange.Redis.KeyNotificationType
66-
StackExchange.Redis.KeyNotificationType.ZInterStore = 43 -> StackExchange.Redis.KeyNotificationType
67-
StackExchange.Redis.KeyNotificationType.ZRem = 48 -> StackExchange.Redis.KeyNotificationType
68-
StackExchange.Redis.KeyNotificationType.ZRemByRank = 46 -> StackExchange.Redis.KeyNotificationType
69-
StackExchange.Redis.KeyNotificationType.ZRemByScore = 47 -> StackExchange.Redis.KeyNotificationType
70-
StackExchange.Redis.KeyNotificationType.ZUnionStore = 44 -> StackExchange.Redis.KeyNotificationType
57+
StackExchange.Redis.KeyNotificationType.XAdd = 33 -> StackExchange.Redis.KeyNotificationType
58+
StackExchange.Redis.KeyNotificationType.XDel = 34 -> StackExchange.Redis.KeyNotificationType
59+
StackExchange.Redis.KeyNotificationType.XGroupCreate = 36 -> StackExchange.Redis.KeyNotificationType
60+
StackExchange.Redis.KeyNotificationType.XGroupCreateConsumer = 35 -> StackExchange.Redis.KeyNotificationType
61+
StackExchange.Redis.KeyNotificationType.XGroupDelConsumer = 37 -> StackExchange.Redis.KeyNotificationType
62+
StackExchange.Redis.KeyNotificationType.XGroupDestroy = 38 -> StackExchange.Redis.KeyNotificationType
63+
StackExchange.Redis.KeyNotificationType.XGroupSetId = 39 -> StackExchange.Redis.KeyNotificationType
64+
StackExchange.Redis.KeyNotificationType.XSetId = 40 -> StackExchange.Redis.KeyNotificationType
65+
StackExchange.Redis.KeyNotificationType.XTrim = 41 -> StackExchange.Redis.KeyNotificationType
66+
StackExchange.Redis.KeyNotificationType.ZAdd = 42 -> StackExchange.Redis.KeyNotificationType
67+
StackExchange.Redis.KeyNotificationType.ZDiffStore = 43 -> StackExchange.Redis.KeyNotificationType
68+
StackExchange.Redis.KeyNotificationType.ZIncr = 46 -> StackExchange.Redis.KeyNotificationType
69+
StackExchange.Redis.KeyNotificationType.ZInterStore = 44 -> StackExchange.Redis.KeyNotificationType
70+
StackExchange.Redis.KeyNotificationType.ZRem = 49 -> StackExchange.Redis.KeyNotificationType
71+
StackExchange.Redis.KeyNotificationType.ZRemByRank = 47 -> StackExchange.Redis.KeyNotificationType
72+
StackExchange.Redis.KeyNotificationType.ZRemByScore = 48 -> StackExchange.Redis.KeyNotificationType
73+
StackExchange.Redis.KeyNotificationType.ZUnionStore = 45 -> StackExchange.Redis.KeyNotificationType

0 commit comments

Comments
 (0)