2017-11-23 05:37:08 +00:00
|
|
|
package common
|
|
|
|
|
2018-06-17 07:28:18 +00:00
|
|
|
// NullUserCache is a user cache to be used when you don't want a cache and just want queries to passthrough to the database
|
2017-11-23 05:37:08 +00:00
|
|
|
type NullUserCache struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewNullUserCache gives you a new instance of NullUserCache
|
|
|
|
func NewNullUserCache() *NullUserCache {
|
|
|
|
return &NullUserCache{}
|
|
|
|
}
|
|
|
|
|
2018-06-17 07:28:18 +00:00
|
|
|
// nolint
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) DeallocOverflow(evictPriority bool) (evicted int) {
|
2018-09-19 06:09:03 +00:00
|
|
|
return 0
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Get(id int) (*User, error) {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil, ErrNoRows
|
|
|
|
}
|
2020-04-27 12:41:55 +00:00
|
|
|
|
|
|
|
func (c *NullUserCache) Getn(id int) *User {
|
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) BulkGet(ids []int) (list []*User) {
|
2018-06-24 13:49:29 +00:00
|
|
|
return make([]*User, len(ids))
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) GetUnsafe(id int) (*User, error) {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil, ErrNoRows
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Set(_ *User) error {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Add(_ *User) error {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) AddUnsafe(_ *User) error {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Remove(id int) error {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) RemoveUnsafe(id int) error {
|
2017-11-23 05:37:08 +00:00
|
|
|
return nil
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) BulkRemove(ids []int) {}
|
|
|
|
func (c *NullUserCache) Flush() {
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Length() int {
|
2017-11-23 05:37:08 +00:00
|
|
|
return 0
|
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) SetCapacity(_ int) {
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) GetCapacity() int {
|
2017-11-23 05:37:08 +00:00
|
|
|
return 0
|
|
|
|
}
|