gitee.com/woood2/luca@v1.0.4/internal/cache/nop.go (about)

     1  package cache
     2  
     3  import (
     4  	"sync"
     5  	"time"
     6  )
     7  
     8  func Nop() Cache {
     9  	return nopCache
    10  }
    11  
    12  var nopCache = &NopCache{
    13  	Protector: Protector{
    14  		lock:  sync.Mutex{},
    15  		apply: make(map[string]chan struct{}),
    16  	},
    17  }
    18  
    19  type NopCache struct {
    20  	Protector
    21  	MissHolder
    22  }
    23  
    24  func (c *NopCache) Get(k string, p interface{}) error {
    25  	return Miss
    26  }
    27  
    28  func (c *NopCache) Set(k string, v interface{}, d time.Duration) error {
    29  	return nil
    30  }