github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/common/null_reply_cache.go (about) 1 package common 2 3 // NullReplyCache is a reply cache to be used when you don't want a cache and just want queries to passthrough to the database 4 type NullReplyCache struct { 5 } 6 7 // NewNullReplyCache gives you a new instance of NullReplyCache 8 func NewNullReplyCache() *NullReplyCache { 9 return &NullReplyCache{} 10 } 11 12 // nolint 13 func (c *NullReplyCache) Get(id int) (*Reply, error) { 14 return nil, ErrNoRows 15 } 16 func (c *NullReplyCache) GetUnsafe(id int) (*Reply, error) { 17 return nil, ErrNoRows 18 } 19 func (c *NullReplyCache) BulkGet(ids []int) (list []*Reply) { 20 return make([]*Reply, len(ids)) 21 } 22 func (c *NullReplyCache) Set(_ *Reply) error { 23 return nil 24 } 25 func (c *NullReplyCache) Add(_ *Reply) error { 26 return nil 27 } 28 func (c *NullReplyCache) AddUnsafe(_ *Reply) error { 29 return nil 30 } 31 func (c *NullReplyCache) Remove(id int) error { 32 return nil 33 } 34 func (c *NullReplyCache) RemoveUnsafe(id int) error { 35 return nil 36 } 37 func (c *NullReplyCache) Flush() { 38 } 39 func (c *NullReplyCache) Length() int { 40 return 0 41 } 42 func (c *NullReplyCache) SetCapacity(_ int) { 43 } 44 func (c *NullReplyCache) GetCapacity() int { 45 return 0 46 }