Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不是issue ,是一个小建议,就是 cachekey 的拼接方式 ":" ,看看有可能让用户自定义不? #39

Open
ys-d opened this issue Nov 10, 2024 · 6 comments

Comments

@ys-d
Copy link

ys-d commented Nov 10, 2024

image

如果redis 已经有很多缓存key,然后拼接方式 不是 “:” ,这里就非常难办了

@ys-d
Copy link
Author

ys-d commented Nov 10, 2024

最好去掉分隔符

@daoshenzzg
Copy link
Collaborator

daoshenzzg commented Nov 11, 2024

可以的。Cache Options 加一个可选项,默认 cache key 的分隔符为":",这样就可以自定义啦,稍后发个版本。

@x1nchen
Copy link

x1nchen commented Nov 11, 2024

我这边最近集成到项目里的时候也有类似的问题。不过因为我是新业务,可以允许不同的 key 的分隔符的风格。能自定义是最好的

tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 11, 2024
tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 11, 2024
tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 11, 2024
tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 11, 2024
daoshenzzg added a commit that referenced this issue Nov 11, 2024
feat: Support cache key separator. (#39)
@tollcc
Copy link
Contributor

tollcc commented Nov 11, 2024

Cache Option中已增加2个可选参数separatorDisabled和separator,separatorDisabled可禁用分隔符,separator可自定义分隔符,可根据自己需要灵活配置使用

@ys-d
Copy link
Author

ys-d commented Nov 13, 2024

大佬,如果只用本地缓存和兜底函数,不要redis 缓存这一层,是可以通过什么控制呀

@daoshenzzg
Copy link
Collaborator

daoshenzzg commented Nov 13, 2024

大佬,如果只用本地缓存和兜底函数,不要redis 缓存这一层,是可以通过什么控制呀

可以参考下这个哈:https://github.com/mgtv-tech/jetcache-go/blob/main/cache_test.go#L866-L891
newLocal、newRemote、newBoth分别对应仅本地缓存、仅远程缓存、两级缓存的实例初始化,都是通过Cache Option的函数选项模式控制的。

tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 18, 2024
tollcc pushed a commit to tollcc/jetcache-go that referenced this issue Nov 18, 2024
daoshenzzg pushed a commit that referenced this issue Nov 18, 2024
* feat: Support cache key separator. (#39)

* feat: Support cache key separator. (#39)

---------

Co-authored-by: caihao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants