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 {
|
2022-02-21 03:32:53 +00:00
|
|
|
return &NullUserCache{}
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
|
|
|
|
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) {
|
2022-02-21 03:32:53 +00:00
|
|
|
return 0
|
2018-09-19 06:09:03 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Get(id int) (*User, error) {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil, ErrNoRows
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2020-04-27 12:41:55 +00:00
|
|
|
|
|
|
|
func (c *NullUserCache) Getn(id int) *User {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2020-04-27 12:41:55 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) BulkGet(ids []int) (list []*User) {
|
2022-02-21 03:32:53 +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) {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil, ErrNoRows
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Set(_ *User) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Add(_ *User) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) AddUnsafe(_ *User) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) Remove(id int) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
2019-02-23 06:29:19 +00:00
|
|
|
func (c *NullUserCache) RemoveUnsafe(id int) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return nil
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
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 {
|
2022-02-21 03:32:53 +00:00
|
|
|
return 0
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|
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 {
|
2022-02-21 03:32:53 +00:00
|
|
|
return 0
|
2017-11-23 05:37:08 +00:00
|
|
|
}
|