adelowo/onecache

怎么去掉onecache:前缀。

Closed this issue · 5 comments

我不想使用任何前缀。 怎么去掉?

Hi, I am sorry I don't understand this but I ran your comment through Google Translate, and it gave me "I do not want to use any prefix How to get rid of" and title says "How to get rid of onecache prefix"...

  • Is that what you mean ?

@shizenghua

  • Memcached
      m := memcached.NewMemcachedStore(
		memcache.New("127.0.0.1:11211"),
		"myownprefix",
	)
  • Redis
	opt := &r.Options{
		Addr:     "localhost:6379",
		Password: "", // no password set
		DB:       0,  // use default DB
	}
	redisStore := redis.NewRedisStore(opt, "myownprefix")

yes, use this "NewRedisStore" function, will add prefix, but i don't use any thing prefix.
if the second parma is empty string, the redis key will add "onecache:" prefix.
i mean is the redis key "key", not "onecache:key".
@adelowo

Hmm... I clearly understand you now. The idea behind prefixing was to prevent collision with other processes that might be making use of the same redis database.

I would think about a way to fix this. The default guess for is to introduce options, NewRedisStore(...Option) or improve the existing one by making it NewRedisStore(opt, "key", ...Option..

I would get back to you

Hi @shizenghua , I have been busy this past weeks at work. I would propose a fix in the next week.

PS => Do you have a fix for this already ? If yes, can you PR that or something ?