Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cache/runtime/cache_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func (ca *RuntimeCache) initValue(key string, value interface{}, ttl int64) erro
// Incr increase int64 counter in runtime cache.
func (ca *RuntimeCache) Incr(key string) (int64, error) {
ca.Lock()
defer ca.Unlock()
itemObj, ok := ca.items.Load(key)
if !ok {
// if not exists, auto set new with 0
Expand All @@ -148,15 +149,14 @@ func (ca *RuntimeCache) Incr(key string) (int64, error) {
return 0, errors.New("item val is not (u)int (u)int32 (u)int64")
}

ca.Unlock()

val, _ := strconv.ParseInt(fmt.Sprint(item.value), 10, 64)
return val, nil
}

// Decr decrease counter in runtime cache.
func (ca *RuntimeCache) Decr(key string) (int64, error) {
ca.Lock()
defer ca.Unlock()
itemObj, ok := ca.items.Load(key)
if !ok {
// if not exists, auto set new with 0
Expand Down Expand Up @@ -194,7 +194,6 @@ func (ca *RuntimeCache) Decr(key string) (int64, error) {
default:
return 0, errors.New("item val is not int int64 int32")
}
ca.Unlock()

val, _ := strconv.ParseInt(fmt.Sprint(item.value), 10, 64)
return val, nil
Expand Down
2 changes: 1 addition & 1 deletion consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dotweb
// Global define
const (
// Version current version
Version = "1.8.1"
Version = "1.8.3"
)

// Log define
Expand Down
Loading