use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheMapUtil method put.
@Deprecated
public static <T> T put(CacheConfigBean cacheConfigBean, String key, String field, T value, int seconds) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheMapPut", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", key);
put("field", field);
put("value", value);
put("timeout", seconds);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
if (unitResponseObject.succeeded())
return value;
else
return null;
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheMapUtil method putAll.
public static void putAll(CacheConfigBean cacheConfigBean, String key, Map maps) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheMapPutAll", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", key);
put("maps", maps);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheMapUtil method getAll.
public static <K, V> Map<K, V> getAll(CacheConfigBean cacheConfigBean, String key, Class<K> kClazz, Class<V> vClazz) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheMapGetAll", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", key);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
Map<String, String> map = null;
if (unitResponseObject.getData() != null)
map = Map.class.cast(unitResponseObject.getData());
if (map == null || map.isEmpty())
return new HashMap<>();
Map<K, V> maps = new HashMap<>();
map.forEach((_key, _value) -> {
maps.put(kClazz.cast(_key), Reflection.toType(_value, vClazz));
});
return maps;
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheObjectUtil method luaScript.
@Deprecated
public static Object luaScript(CacheConfigBean cacheConfigBean, String scripts, List<String> keys, List<String> params) {
UnitResponse response = SyncXian.call(CacheService.CACHE_SERVICE, "cacheLua", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("scripts", scripts);
put("keys", keys);
put("params", params);
}
});
response.throwExceptionIfNotSuccess();
return response.getData();
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheObjectUtil method increment.
public static long increment(CacheConfigBean cacheConfigBean, String cacheKey) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheIncrement", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", cacheKey);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
return (long) unitResponseObject.getData();
}
Aggregations