gocache icon indicating copy to clipboard operation
gocache copied to clipboard

Suggestion for an easier interface

Open mikestefanello opened this issue 3 years ago • 0 comments

I wrote and maintain pagoda, a rapid, full-stack web development starter kit. I included gocache to provide a flexible way to handle caching that wouldn't have to be changed if you opt for a different cache provider. While I think this module is great, I found the interface to be somewhat cumbersome to deal with so I wrote a wrapper on top of it that I think turned out pretty well. Since this is something I'd like available in other projects, I thought I'd see if it's something you'd be interested in bringing in.

Here is the overall explanation of how it works and what is available. And here is the client code that provides that.

For quick reference, here is an example:

err := cache.
    Set().
    Key("my-key").
    Tags("tag1", "tag2").
    Expiration(time.Hour * 2).
    Data(myData).
    Save(ctx)

mikestefanello avatar Aug 12 '22 11:08 mikestefanello