SknCodeRequest.java
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.yoho.search.models.recall;
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.cache.CacheTimeConstants;
import com.yoho.search.cache.model.ICacheRequest;
import java.util.Arrays;
import java.util.List;
public class SknCodeRequest implements ICacheRequest {
public static final List<String> includeFields = Arrays.asList(ProductIndexEsField.productSkn,ProductIndexEsField.productSknCode);
private Integer productSkn;
private String codeVersion;
public SknCodeRequest(Integer productSkn,String codeVersion){
this.productSkn = productSkn;
this.codeVersion = codeVersion;
}
@Override
public RedisKeyBuilder redisKeyBuilder() {
return RedisKeyBuilder.newInstance().appendFixed("YOHOSEARCH:").appendFixed("SKN_CODE:").appendVar(codeVersion).appendFixed(":").appendVar(cacheTimeInMinute()).appendFixed(":").appendVar(productSkn);
}
@Override
public int cacheTimeInMinute() {
return CacheTimeConstants.SKN_CODE;
}
public Integer getProductSkn() {
return productSkn;
}
}