Closed jimeh closed 1 year ago
Hi,
New v4.0.0
release have now separated stores into a separated Go module.
So now we have the library that can be imported:
import "github.com/eko/gocache/v4/lib"
and one or multiple cache store(s):
import (
"github.com/eko/gocache/v4/store/bigcache"
"github.com/eko/gocache/v4/store/freecache"
"github.com/eko/gocache/v4/store/go_cache"
"github.com/eko/gocache/v4/store/memcache"
"github.com/eko/gocache/v4/store/pegasus"
"github.com/eko/gocache/v4/store/redis"
"github.com/eko/gocache/v4/store/rediscluster"
"github.com/eko/gocache/v4/store/ristretto"
)
I close this issue for now but feel free to reopen if you still have any issue.
Having all the different built-in store implementations in the same one Go module means that their dependencies are also pulled in when using
eko/gocahce
.If the built-in implementations were moved to their own sub-modules with their own
go.mod
files, it would enable a much smaller dependency tree narrowed to only what you're actively using.This should avoid issues like #144 for everyone not actively using the Pegasus store, since they wouldn't be pulling in the pegasus client package as a dependency.
For me this has become a bit of an issue at the moment while trying to use gocache within a custom Traefik plugin. Traefik runs plugins via Yaegi, which means you cannot have anything in the dependency tree that uses the
unsafe
orsyscall
packages.I'm fully aware a change like this would be a major breaking change, but I'd like to maybe get the discussion started.
Also, if it would help, I'd be happy to take a stab at the separation myself and submit a PR.