Gets fail in case of small caches

Hey, the entry is being rejected because it doesn’t fit in the max cost. The maxCost you’ve set is 40 but the cost of the entry turns out to be 41 (we include the cost of storing it as well).

If you make the following change to your code

	cache, err := ristretto.NewCache(&ristretto.Config{
		NumCounters: 400,
		MaxCost:     40,
		BufferItems: 64,
		OnReject: func(item *ristretto.Item) {
			fmt.Printf("Rejected item = %+v\n", item)
		},
	})

You’ll see see that the actual cost of the item is 41

Rejected item = &{
    flag:0
    Key:3107470939456627393
    Conflict:4933520039084114740
    Value:value
    Cost:41
    Expiration:0
    wg:<nil>
}

We add the cost here