###數據緩存存儲(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");
```