use of info.xiancloud.core.support.cache.CacheConfigBean in project xian by happyyangyuan.
the class CacheMapKeysUnit method execute.
@Override
public UnitResponse execute(UnitRequest msg) {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try {
Set<String> keys = Redis.call(cacheConfigBean, jedis -> jedis.hkeys(key));
return UnitResponse.success(keys);
} catch (Exception e) {
return UnitResponse.exception(e);
}
}
use of info.xiancloud.core.support.cache.CacheConfigBean in project xian by happyyangyuan.
the class CacheMapPutUnit method execute.
@Override
public UnitResponse execute(UnitRequest msg) {
String key = msg.getArgMap().get("key").toString();
String field = msg.getArgMap().get("field").toString();
Object valueObj = msg.getArgMap().get("value");
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try {
long result = Redis.call(cacheConfigBean, jedis -> {
String value = FormatUtil.formatValue(valueObj);
return jedis.hset(key, field, value);
});
if (result == 0)
return UnitResponse.success("存在, 覆盖");
else if (result == 1)
return UnitResponse.success("新建, 设置");
} catch (Exception e) {
return UnitResponse.exception(e);
}
return UnitResponse.success();
}
use of info.xiancloud.core.support.cache.CacheConfigBean in project xian by happyyangyuan.
the class CacheMapRemoveUnit method execute.
@Override
public UnitResponse execute(UnitRequest msg) {
String key = msg.getArgMap().get("key").toString();
String field = msg.getArgMap().get("field").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
long length;
try {
length = Redis.call(cacheConfigBean, jedis -> jedis.hdel(key, field));
} catch (Exception e) {
return UnitResponse.exception(e);
}
return UnitResponse.success(length);
}
use of info.xiancloud.core.support.cache.CacheConfigBean in project xian by happyyangyuan.
the class CacheMapSizeUnit method execute.
@Override
public UnitResponse execute(UnitRequest msg) {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try {
long size = Redis.call(cacheConfigBean, jedis -> jedis.hlen(key));
return UnitResponse.success(size);
} catch (Exception e) {
return UnitResponse.exception(e);
}
}
use of info.xiancloud.core.support.cache.CacheConfigBean in project xian by happyyangyuan.
the class CacheMapValuesUnit method execute.
@Override
public UnitResponse execute(UnitRequest msg) {
String key = msg.getArgMap().get("key").toString();
CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
try {
List<String> values = Redis.call(cacheConfigBean, jedis -> jedis.hvals(key));
return UnitResponse.success(values);
} catch (Exception e) {
return UnitResponse.exception(e);
}
}
Aggregations