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