Skip to content

Commit 49c327f

Browse files
committed
message parsing code and empty test shell
1 parent 2d8fa02 commit 49c327f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: pubsub.go

+15
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,21 @@ func (c *PubSub) newMessage(reply interface{}) (interface{}, error) {
409409
return &Pong{
410410
Payload: reply[1].(string),
411411
}, nil
412+
case "invalidate":
413+
switch payload := reply[1].(type) {
414+
case []interface{}:
415+
_ = payload
416+
s := make([]string, len(payload))
417+
for idx := range payload {
418+
s[idx] = payload[idx].(string)
419+
}
420+
return &Message{
421+
Channel: "invalidate",
422+
PayloadSlice: s,
423+
}, nil
424+
default:
425+
return nil, fmt.Errorf("redis: unsupported invalidate message payload: %q", payload)
426+
}
412427
default:
413428
return nil, fmt.Errorf("redis: unsupported pubsub message: %q", kind)
414429
}

Diff for: pubsub_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -567,4 +567,6 @@ var _ = Describe("PubSub", func() {
567567
Expect(msg.Channel).To(Equal("mychannel"))
568568
Expect(msg.Payload).To(Equal(text))
569569
})
570+
571+
It("should channel client-cache invalidation messages", func() {})
570572
})

0 commit comments

Comments
 (0)