Search in sources :

Example 96 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class CacheObjectUtil method keys.

public static Set<String> keys(CacheConfigBean cacheConfigBean, String pattern) {
    UnitResponse response = SyncXian.call(CacheService.CACHE_SERVICE, "cacheKeys", new JSONObject() {

        {
            put("cacheConfig", cacheConfigBean);
            put("pattern", pattern);
        }
    });
    response.throwExceptionIfNotSuccess();
    return response.getData();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) UnitResponse(info.xiancloud.core.message.UnitResponse)

Example 97 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class CacheObjectUtil method exists.

public static boolean exists(CacheConfigBean cacheConfigBean, String cacheKey) {
    UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheExists", new JSONObject() {

        {
            put("cacheConfig", cacheConfigBean);
            put("key", cacheKey);
        }
    });
    unitResponseObject.throwExceptionIfNotSuccess();
    return (boolean) unitResponseObject.getData();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) UnitResponse(info.xiancloud.core.message.UnitResponse)

Example 98 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class CacheObjectUtil method remove.

public static boolean remove(CacheConfigBean cacheConfigBean, String cacheKey) {
    UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheObjectRemove", new JSONObject() {

        {
            put("cacheConfig", cacheConfigBean);
            put("key", cacheKey);
        }
    });
    unitResponseObject.throwExceptionIfNotSuccess();
    return unitResponseObject.succeeded();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) UnitResponse(info.xiancloud.core.message.UnitResponse)

Example 99 with UnitResponse

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, int timeoutInSecond) {
    UnitResponse response = SyncXian.call(CacheService.CACHE_SERVICE, "cacheObject", new JSONObject() {

        {
            put("cacheConfig", cacheConfigBean);
            put("key", cacheKey);
            put("value", value);
            put("timeout", timeoutInSecond);
        }
    });
    response.throwExceptionIfNotSuccess();
    return response.succeeded();
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) UnitResponse(info.xiancloud.core.message.UnitResponse)

Example 100 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class CacheObjectUtil method scan.

/**
 * @param cacheConfigBean cacheConfigBean
 * @param pattern         pattern
 * @param count           count
 * @param cursor          cursor
 * @return ScanVo
 * @deprecated 不建议使用该 API, 各种不稳定
 */
public static ScanVo scan(CacheConfigBean cacheConfigBean, String pattern, int count, String cursor) {
    UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheScan", new JSONObject() {

        {
            put("cacheConfig", cacheConfigBean);
            put("pattern", pattern);
            put("count", count);
            put("cursor", cursor);
        }
    });
    unitResponseObject.throwExceptionIfNotSuccess();
    JSONObject jsonObject = unitResponseObject.getData();
    return new ScanVo(jsonObject);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) ScanVo(info.xiancloud.core.support.cache.vo.ScanVo) UnitResponse(info.xiancloud.core.message.UnitResponse)

Aggregations

UnitResponse (info.xiancloud.core.message.UnitResponse)106 JSONObject (com.alibaba.fastjson.JSONObject)74 HashMap (java.util.HashMap)22 UnitRequest (info.xiancloud.core.message.UnitRequest)17 NotifyHandler (info.xiancloud.core.NotifyHandler)16 JSONArray (com.alibaba.fastjson.JSONArray)9 Unit (info.xiancloud.core.Unit)6 UnitMeta (info.xiancloud.core.UnitMeta)6 CacheGroup (info.xiancloud.cache.service.CacheGroup)5 Group (info.xiancloud.core.Group)5 Input (info.xiancloud.core.Input)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 Redis (info.xiancloud.cache.redis.Redis)4 CacheConfigBean (info.xiancloud.core.support.cache.CacheConfigBean)4 ThreadPoolManager (info.xiancloud.core.thread_pool.ThreadPoolManager)3 LOG (info.xiancloud.core.util.LOG)3 Set (java.util.Set)3 Test (org.junit.Test)3 MessageType (info.xiancloud.core.distribution.MessageType)2 UnitUndefinedException (info.xiancloud.core.distribution.exception.UnitUndefinedException)2