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

Add prefix for cache keys. #3702

Closed
wants to merge 22 commits into from
Closed

Add prefix for cache keys. #3702

wants to merge 22 commits into from

Conversation

fucktx
Copy link

@fucktx fucktx commented Nov 7, 2023

redis默认是db0,很多项目共用redis实例的时候,可能导致redis的key重复,生成cache的时候加上prefix,这个参数可以是当前项目的名字,这样就可以很好的解决共用redis实例的时候,相同的表的redis缓存key一致的情况.eg:cache:system:config:id(old: cache:config:id)

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #3702 (f098403) into master (72dd273) will increase coverage by 0.01%.
The diff coverage is n/a.

❗ Current head f098403 differs from pull request most recent head 2d120e1. Consider uploading reports for the commit 2d120e1 to get more accurate results

Additional details and impacted files

see 1 file with indirect coverage changes

@kevwan kevwan changed the title cache添加一个区分的前缀 Add prefix for cache keys. Nov 7, 2023
@kesonan
Copy link
Collaborator

kesonan commented Nov 7, 2023

A same argument named database for mysql and schema for pg was supported, so I think this changes maybe duplicate.

@kevwan kevwan added the area/goctl Categorizes issue or PR as related to goctl. label Nov 7, 2023
@fucktx
Copy link
Author

fucktx commented Nov 9, 2023

A same argument named database for mysql and schema for pg was supported, so I think this changes maybe duplicate.
@kesonan 对于不同的项目来着,如果公用一个redis实例的时候,相同的schema,这时候数据就有可能重复,再比如极端点,id都是自增的,这时候数据就可以混了,或者就是支持redis 的db可以配置,不然很可能出现这样 的情况,我们测试环境就出现了好几起这样的事情

@kesonan
Copy link
Collaborator

kesonan commented Nov 14, 2023

A same argument named database for mysql and schema for pg was supported, so I think this changes maybe duplicate.
@kesonan 对于不同的项目来着,如果公用一个redis实例的时候,相同的schema,这时候数据就有可能重复,再比如极端点,id都是自增的,这时候数据就可以混了,或者就是支持redis 的db可以配置,不然很可能出现这样 的情况,我们测试环境就出现了好几起这样的事情

I know your business scenario, the parameters schema and database that have been provided so far are not just literal, it's not a matter of providing as many parameters with as many prefixes as the developer needs, you can add arbitrary strings to control that, or even a single project prefix, so all you need is a prefix that can differentiate between the cache keys.

@fucktx
Copy link
Author

fucktx commented Nov 15, 2023

A same argument named database for mysql and schema for pg was supported, so I think this changes maybe duplicate.
@kesonan 对于不同的项目来着,如果公用一个redis实例的时候,相同的schema,这时候数据就有可能重复,再比如极端点,id都是自增的,这时候数据就可以混了,或者就是支持redis 的db可以配置,不然很可能出现这样 的情况,我们测试环境就出现了好几起这样的事情

I know your business scenario, the parameters schema and database that have been provided so far are not just literal, it's not a matter of providing as many parameters with as many prefixes as the developer needs, you can add arbitrary strings to control that, or even a single project prefix, so all you need is a prefix that can differentiate between the cache keys.

@kesonan 对,是这样,因为现在redis默认是固定死的,有一个前缀,这样在业务上不会造成各种困扰

@fucktx fucktx closed this Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/goctl Categorizes issue or PR as related to goctl.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants