gosora/common/null_reply_cache.go

47 lines
1.1 KiB
Go
Raw Normal View History

package common
// NullReplyCache is a reply cache to be used when you don't want a cache and just want queries to passthrough to the database
type NullReplyCache struct {
}
// NewNullReplyCache gives you a new instance of NullReplyCache
func NewNullReplyCache() *NullReplyCache {
2022-02-21 03:32:53 +00:00
return &NullReplyCache{}
}
// nolint
func (c *NullReplyCache) Get(id int) (*Reply, error) {
2022-02-21 03:32:53 +00:00
return nil, ErrNoRows
}
func (c *NullReplyCache) GetUnsafe(id int) (*Reply, error) {
2022-02-21 03:32:53 +00:00
return nil, ErrNoRows
}
func (c *NullReplyCache) BulkGet(ids []int) (list []*Reply) {
2022-02-21 03:32:53 +00:00
return make([]*Reply, len(ids))
}
func (c *NullReplyCache) Set(_ *Reply) error {
2022-02-21 03:32:53 +00:00
return nil
}
func (c *NullReplyCache) Add(_ *Reply) error {
2022-02-21 03:32:53 +00:00
return nil
}
func (c *NullReplyCache) AddUnsafe(_ *Reply) error {
2022-02-21 03:32:53 +00:00
return nil
}
func (c *NullReplyCache) Remove(id int) error {
2022-02-21 03:32:53 +00:00
return nil
}
func (c *NullReplyCache) RemoveUnsafe(id int) error {
2022-02-21 03:32:53 +00:00
return nil
}
func (c *NullReplyCache) Flush() {
}
func (c *NullReplyCache) Length() int {
2022-02-21 03:32:53 +00:00
return 0
}
func (c *NullReplyCache) SetCapacity(_ int) {
}
func (c *NullReplyCache) GetCapacity() int {
2022-02-21 03:32:53 +00:00
return 0
}