|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
package com.fr.plugin.db.redis.help.client; |
|
|
|
|
|
|
|
|
|
import com.fr.base.TableData; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fanruan.api.log.LogKit; |
|
|
|
|
import com.fr.plugin.db.redis.core.emb.Redis; |
|
|
|
|
import com.fr.plugin.db.redis.help.Console; |
|
|
|
|
import com.fr.plugin.db.redis.help.ScriptBridge; |
|
|
|
@ -42,7 +42,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Object[] hkeys(String key) { |
|
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
|
Set<String> set = jedis.keys(key); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return set.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -51,7 +51,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Object[] hmget(String key, String... fields) { |
|
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
|
List<String> list = jedis.hmget(key, fields); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return list.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -60,7 +60,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Map<Object, Object> hgetAll(String key) { |
|
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
|
Map<String, String> map = jedis.hgetAll(key); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return new TreeMap<Object, Object>(map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -69,7 +69,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Object[] keys(String pattern) { |
|
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
|
Set<String> set = jedis.keys(pattern); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return set.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -78,7 +78,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Object[] lrange(String key, long start, long end) { |
|
|
|
|
long start0 = System.currentTimeMillis(); |
|
|
|
|
List<String> list = jedis.lrange(key, start, end); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start0); |
|
|
|
|
return list.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -92,7 +92,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
parameters[i] = String.valueOf(keys[i]); |
|
|
|
|
} |
|
|
|
|
List<String> list = jedis.mget(parameters); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return list.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -101,7 +101,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
public Object[] smembers(String key) { |
|
|
|
|
long start = System.currentTimeMillis(); |
|
|
|
|
Set<String> set = jedis.smembers(key); |
|
|
|
|
FineLoggerFactory.getLogger().info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
LogKit.info("Fetch data from redis spend time {} ms.", System.currentTimeMillis() - start); |
|
|
|
|
return set.toArray(new String[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -150,7 +150,7 @@ public class RedisNashornClient extends BaseRedisClient<Object[], Map<Object, Ob
|
|
|
|
|
} |
|
|
|
|
return new SimpleDataModel(columnNames, data, realCount); |
|
|
|
|
} catch (ScriptException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
LogKit.error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|