27 lines
704 B
Plaintext
27 lines
704 B
Plaintext
package jnpf.util;
|
|
|
|
import jnpf.model.TenantVO;
|
|
|
|
public class TenantDbContentCacheHelper {
|
|
|
|
private static final String CACHE_KEY_PREFIX = "tenant:db:content:";
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
public String buildCacheKey(String encode) {
|
|
return CACHE_KEY_PREFIX + encode;
|
|
}
|
|
|
|
public void cacheSuccess(String encode, TenantVO vo, Long expiresAtMs) {
|
|
CacheEnvelope envelope = new CacheEnvelope();
|
|
envelope.setVo(vo);
|
|
envelope.setExpiresAtMs(expiresAtMs);
|
|
redisUtil.insert(buildCacheKey(encode), JSON.toJSONString(envelope), 100);
|
|
}
|
|
|
|
public static class CacheEnvelope {
|
|
private TenantVO vo;
|
|
private Long expiresAtMs;
|
|
}
|
|
}
|