github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/rpc/nats/subscriber_fastcache_processor.go (about)

     1  package nats
     2  
     3  // CachePoolWorker is a fast cache Worker.
     4  type CachePoolWorker struct {
     5  	processor func(msg *CacheMsg) error
     6  }
     7  
     8  // CacheMsg is a structure used by Subscribers.
     9  type CacheMsg struct {
    10  	Key uint64
    11  	Val []byte
    12  }
    13  
    14  func (w *CachePoolWorker) Process(payload interface{}) interface{} {
    15  	return w.processor(payload.(*CacheMsg))
    16  }
    17  
    18  func (w *CachePoolWorker) BlockUntilReady() {}
    19  func (w *CachePoolWorker) Interrupt()       {}
    20  func (w *CachePoolWorker) Terminate()       {}