Is there any maximum length of Go's string map key? Actually I use https://github.com/OneOfOne/cmap instead of Go's map.
The question is, the key I use in that cmap
is about 200-4000 characters in length, will it be a problem/gotchas?
import "gitlab.com/kokizzu/gokil/I"
import "sync/atomic"
var CACHE_IDX int64
var CACHE_KEYS cmap.CMap
func init() {
CACHE_KEYS = cmap.New()
}
// change a really long string to a shorter one
func RamKey_ByQuery(query string) string {
nkey := CACHE_KEYS.Get(query)
if nkey != nil {
return nkey.(string)
}
new_idx := atomic.AddInt64(&CACHE_IDX, 1)
ram_key := `:` + I.ToS(new_idx) // convert integer to string
CACHE_KEYS.Set(query, ram_key)
return ram_key
}