fix comment function names (#649)

master
Kevin Wan 4 years ago committed by GitHub
parent 006f78c3d5
commit 9adc7d4cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -59,7 +59,7 @@ func NewNode(rds *redis.Redis, barrier syncx.SharedCalls, st *Stat,
} }
} }
// DelCache deletes cached values with keys. // Del deletes cached values with keys.
func (c cacheNode) Del(keys ...string) error { func (c cacheNode) Del(keys ...string) error {
if len(keys) == 0 { if len(keys) == 0 {
return nil return nil
@ -73,7 +73,7 @@ func (c cacheNode) Del(keys ...string) error {
return nil return nil
} }
// GetCache gets the cache with key and fills into v. // Get gets the cache with key and fills into v.
func (c cacheNode) Get(key string, v interface{}) error { func (c cacheNode) Get(key string, v interface{}) error {
err := c.doGetCache(key, v) err := c.doGetCache(key, v)
if err == errPlaceholder { if err == errPlaceholder {
@ -88,12 +88,12 @@ func (c cacheNode) IsNotFound(err error) bool {
return err == c.errNotFound return err == c.errNotFound
} }
// SetCache sets the cache with key and v, using c.expiry. // Set sets the cache with key and v, using c.expiry.
func (c cacheNode) Set(key string, v interface{}) error { func (c cacheNode) Set(key string, v interface{}) error {
return c.SetWithExpire(key, v, c.aroundDuration(c.expiry)) return c.SetWithExpire(key, v, c.aroundDuration(c.expiry))
} }
// SetCacheWithExpire sets the cache with key and v, using given expire. // SetWithExpire sets the cache with key and v, using given expire.
func (c cacheNode) SetWithExpire(key string, v interface{}, expire time.Duration) error { func (c cacheNode) SetWithExpire(key string, v interface{}, expire time.Duration) error {
data, err := jsonx.Marshal(v) data, err := jsonx.Marshal(v)
if err != nil { if err != nil {
@ -108,7 +108,7 @@ func (c cacheNode) String() string {
return c.rds.Addr return c.rds.Addr
} }
// TakeWithExpire takes the result from cache first, if not found, // Take takes the result from cache first, if not found,
// query from DB and set cache using c.expiry, then return the result. // query from DB and set cache using c.expiry, then return the result.
func (c cacheNode) Take(v interface{}, key string, query func(v interface{}) error) error { func (c cacheNode) Take(v interface{}, key string, query func(v interface{}) error) error {
return c.doTake(v, key, query, func(v interface{}) error { return c.doTake(v, key, query, func(v interface{}) error {

Loading…
Cancel
Save