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

重写 JedisExpireKey 感觉怪怪的 #204

Open
dearMOMO opened this issue May 24, 2019 · 2 comments
Open

重写 JedisExpireKey 感觉怪怪的 #204

dearMOMO opened this issue May 24, 2019 · 2 comments

Comments

@dearMOMO
Copy link

private static final String DEFAULT_VALUE = ""; 怎么设置呢
@OverRide
public boolean add(String key, int expire) {
redisTemplateString.opsForValue().set(perfix + key,JedisExpireKey.DEFAULT_EXPIRE,expire);
return super.add(key, expire);
} 我发现我根本无法设置 Value

@dearMOMO
Copy link
Author

@DaTa
public class WxSpringRedisConfigStorage extends JedisExpireKey {
private final RedisTemplate<String, String> redisTemplateString;

private String perfix = "WP_ExpireKey_";
public WxSpringRedisConfigStorage(RedisTemplate<String, String> redisTemplateString) {
    this.redisTemplateString = redisTemplateString;
}


@Override
public void setPerfix(String perfix) {
    super.setPerfix(perfix);
}


@Override
public boolean add(String key, int expire) {
    redisTemplateString.opsForValue().set(perfix + key,JedisExpireKey.DEFAULT_EXPIRE,expire);
    return super.add(key, expire);
}

@Override
public boolean add(String key) {
    return super.add(key);
}

@Override
public boolean exists(String key) {
    return super.exists(key);
}

}

@liyiorg
Copy link
Owner

liyiorg commented May 30, 2019

JedisExpireKey 的目的在于标记key 是否过期,不关心value 是什么。

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

2 participants