alibaba / alibaba/jetcache

area的名称是否支持自定义默认的名称

Open
#533 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

我的使用场景是这样的,有dev ,test, prd 3个环境。我想要area的名称和这3个环境的名称对应起来,是否支持?
因为dev和test的redis是同一个,所以如果不区分的话,会造成dev和test2个环境的redis数据想到覆盖影响。
我现在想到的办法是在配置文件中加了一个参数env_flag =dev或 env_flag=test
但我不知道应该如果将这个env_flag的值,传给area?
类似于
@Value("${env_flag}")
private String myCacheArea;

@Cached(area="这里希望能用到上面的myCacheArea的值",name="findxxxx",key="xxx",cacheType = CacheType.BOTH)

或者是能在配置文件中提供一个参数能指定一下area的名称也行,现在我看配置文件中没办法修改默认参数的名称,只能是默认找default,有没有办法提供个参数可以设置默认area的名称?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the @Cached annotation and the configuration that currently supplies the default area. Compare the requested env_flag or configurable default area with the existing annotation and cache configuration entry points. Done means dev, test, and prd can select distinct area names so shared Redis data cannot overlap, with coverage for the configured behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis, spring
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.