use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheMapUtil method batchRemove.
/**
* @param cacheConfigBean cacheConfigBean
* @param batchRemoves Map(key, fields)
*/
public static void batchRemove(CacheConfigBean cacheConfigBean, Map<String, List<String>> batchRemoves) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheMapBatchRemove", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("batchRemoves", batchRemoves);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheMapUtil method size.
public static long size(CacheConfigBean cacheConfigBean, String key) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheMapSize", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", key);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
long size = (long) unitResponseObject.getData();
return size > 0 ? size : 0;
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheObjectUtil method decrementByValue.
public static long decrementByValue(CacheConfigBean cacheConfigBean, String cacheKey, long value, int timeoutInSecond) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheDecrement", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", cacheKey);
put("value", value);
put("timeout", timeoutInSecond);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
return (long) unitResponseObject.getData();
}
use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.
the class CacheObjectUtil method set.
public static boolean set(CacheConfigBean cacheConfigBean, String cacheKey, Object value) {
UnitResponse response = SyncXian.call(CacheService.CACHE_SERVICE, "cacheObject", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("key", cacheKey);
put("value", value);
}
});
response.throwExceptionIfNotSuccess();
return response.succeeded();
}
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, int keyCount, List<String> params) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheLua", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("scripts", scripts);
put("keyCount", keyCount);
put("params", params);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
if (unitResponseObject.getData() == null)
return null;
return unitResponseObject.getData();
}
Aggregations