Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tyzhnenko committed Oct 13, 2019
1 parent f368c74 commit fb6f7da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package lcw
import (
"sync/atomic"
"time"
"unsafe"

"github.com/go-redis/redis"
"github.com/pkg/errors"
Expand Down Expand Up @@ -115,9 +114,11 @@ func (c *RedisCache) allowed(key string, data Value) bool {
if c.maxKeySize > 0 && len(key) > c.maxKeySize {
return false
}
if unsafe.Sizeof(data) > (512 * 1024 * 1024) {
return false
if s, ok := data.(Sizer); ok {
// Maximum allowed value size in Redis
if s.Size() >= (512 * 1024 * 1024) {
return false
}
}

return true
}

0 comments on commit fb6f7da

Please sign in to comment.