github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/common/null_user_cache.go (about)

     1  package common
     2  
     3  // NullUserCache is a user cache to be used when you don't want a cache and just want queries to passthrough to the database
     4  type NullUserCache struct {
     5  }
     6  
     7  // NewNullUserCache gives you a new instance of NullUserCache
     8  func NewNullUserCache() *NullUserCache {
     9  	return &NullUserCache{}
    10  }
    11  
    12  // nolint
    13  func (c *NullUserCache) DeallocOverflow(evictPriority bool) (evicted int) {
    14  	return 0
    15  }
    16  func (c *NullUserCache) Get(id int) (*User, error) {
    17  	return nil, ErrNoRows
    18  }
    19  
    20  func (c *NullUserCache) Getn(id int) *User {
    21  	return nil
    22  }
    23  func (c *NullUserCache) BulkGet(ids []int) (list []*User) {
    24  	return make([]*User, len(ids))
    25  }
    26  func (c *NullUserCache) GetUnsafe(id int) (*User, error) {
    27  	return nil, ErrNoRows
    28  }
    29  func (c *NullUserCache) Set(_ *User) error {
    30  	return nil
    31  }
    32  func (c *NullUserCache) Add(_ *User) error {
    33  	return nil
    34  }
    35  func (c *NullUserCache) AddUnsafe(_ *User) error {
    36  	return nil
    37  }
    38  func (c *NullUserCache) Remove(id int) error {
    39  	return nil
    40  }
    41  func (c *NullUserCache) RemoveUnsafe(id int) error {
    42  	return nil
    43  }
    44  func (c *NullUserCache) BulkRemove(ids []int) {}
    45  func (c *NullUserCache) Flush() {
    46  }
    47  func (c *NullUserCache) Length() int {
    48  	return 0
    49  }
    50  func (c *NullUserCache) SetCapacity(_ int) {
    51  }
    52  func (c *NullUserCache) GetCapacity() int {
    53  	return 0
    54  }