cache icon indicating copy to clipboard operation
cache copied to clipboard

How to use cache like map[string]any?

Open ttktatakai opened this issue 1 year ago • 0 comments

Is there any way that I can use this cache like map[string]any, I mean using get operation as following?

    val, err := mycache.Get(ctx, key)

The difference is, I do not know the type of value when I query the key, so I do not know the type of wanted which I need to create.

    if err := mycache.Get(ctx, key, &wanted); err == nil {
        fmt.Println(wanted)
    }

ttktatakai avatar Mar 18 '24 08:03 ttktatakai