MCPcopy Create free account
hub / github.com/ebosas/microservices / updateRedis

Function updateRedis

cmd/cache/cache.go:49–61  ·  view source on GitHub ↗

updateRedis updates Redis with a new Rabbit message.

(d amqp.Delivery, c *redis.Client)

Source from the content-addressed store, hash-verified

47
48// updateRedis updates Redis with a new Rabbit message.
49func updateRedis(d amqp.Delivery, c *redis.Client) bool {
50 // Add a message, limit to 10 in cache, increment total count.
51 if _, err := c.Pipelined(ctx, func(pipe redis.Pipeliner) error {
52 pipe.LPush(ctx, "messages", d.Body)
53 pipe.LTrim(ctx, "messages", 0, 9)
54 pipe.Incr(ctx, "total")
55 return nil
56 }); err != nil {
57 log.Fatalf("update redis: %s", err)
58 }
59
60 return true
61}

Callers 2

mainFunction · 0.85
TestUpdateRedisFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestUpdateRedisFunction · 0.68