MCPcopy
hub / github.com/canopy-network/canopy / NewMessageCache

Function NewMessageCache

lib/peer.go:251–257  ·  view source on GitHub ↗

NewMessageCache() initializes and returns a new MessageCache instance

()

Source from the content-addressed store, hash-verified

249
250// NewMessageCache() initializes and returns a new MessageCache instance
251func NewMessageCache() *MessageCache {
252 return &MessageCache{
253 queue: list.New(),
254 deDupe: NewDeDuplicator[string](),
255 maxSize: 10000,
256 }
257}
258
259// Add inserts a new message into the cache if it doesn't already exist
260// It removes the oldest message if the cache is full

Callers 3

ListenForConsensusMethod · 0.92
ListenForTxMethod · 0.92
ListenForBlockMethod · 0.92

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected