ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
###数据缓存存储(epii-no-sql) #### 1 maven引入 ```xml <dependency> <groupId>epii.spring</groupId> <artifactId>epii-no-sql-starter</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> ``` #### 2 配置生成参数 **注意:** * 引用的类必须加上注解@EpiiValueCreater * 返回参数类型跟最终要获取的类型要一致 * 传入参数类型(构成key的类型)支持 int Integer Sting ```java @EpiiValueCreater public class testConf { //设置无参数值 @EpiiValueCreater("pro-config") public HashMap setProConfig(){ HashMap info=new HashMap(); info.put("param","参数值一"); info.put("param2","参数值二"); return info; } //获取值,并设置3秒后过期 @EpiiValueCreater(key = "aaa",effectiveTime = 3000) public int test(){ return Time.getTime(); } //设置两个参数 @EpiiValueCreater("info-{*}-{*}") public boolean getInfo(int a,String b){ return true; } //设置一个参数 @EpiiValueCreater("user-info-{*}") public UserModel getUser(int user_id){ UserModel userModel = new UserModel(); userModel.setAdd_time(1); userModel.setId(user_id); return userModel; } } ``` #### 3 获取值 ```java //获取无参数值 (注意返回类型) HashMap hashMap = EpiiStore.get("pro-config", HashMap.class); //获取值 (有过期时间) int time = EpiiStore.getInt("aaa"); //获取值(两个参数) Boolean bool = EpiiStore.getBool("info-1-str"); //获取值(一个参数) UserModel userInfo = EpiiStore.get("user-info-1", UserModel.class); ``` ```jql 上述返回结果: {param=参数值一, param2=参数值二} 1684917734 true UserModel(id=1, name=null, add_time=1) ``` #### 3 重新加载值 ```java boolean loadRes = EpiiStore.load("pro-config"); ```