redis中以目录形式存储和读取数据

叙述

项目中需要往 Redis 中写入和读取数据时,要以目录形式进行。

解决方案

key设置,可以参考以下:

/**
 * redis key 接口参数
 * key:key值
 * expiredate:过期时间
 */
public interface RedisKey {
    long START = 0L;
    long END = -1L;
    String TOKEN = "token:token-";
    int TOKEN_EXPIRE_DATE = 24 * 3600;
    String COMPANY_TREE_ALL = "company:companyTree-all";
    String COMPANY_TREE = "company:companyTree-";
    String REGION_TREE_ALL = "company:regionTree-all";
    String REGION_TREE = "company:regionTree-";
    String DEPARTMENT_TREE = "department:departmentTree-";
    String DEPARTMENT_LIST = "department:departmentList-";
    int DATA_EXPIRE_DATE = 8 * 3600;
}

请看 

company:companyTree-all

company:companyTree-all (company指的是目录名称   companyTree-all是目录内的key)

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值