Skip to content

fastcache doesn't store value with length of exactly 512k #60

Description

@AlexBlack772

I've faced with an issue that fastcache doesn't store value with length of exactly 512k

func main() {
	cache := fastcache.New(1024)

	var key, val []byte

	key = []byte("k")
	val = make([]byte, 512000)

	cache.SetBig(key, val)
	val = cache.GetBig(nil, key)

	if val == nil {
		fmt.Println("Value is missing")
	} else {
		fmt.Println("Value is OK")
		fmt.Println(len(val))
	}
}

The code prints "Value is missing", but if I create val as make([]byte, 512000+1) then I can set and get value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions