本文整理了Java中redis.clients.jedis.Jedis.hget()
方法的一些代码示例,展示了Jedis.hget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.hget()
方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:hget
[英]If key holds a hash, retrieve the value associated to the specified field.
If the field is not found or the key does not exist, a special 'nil' value is returned.
Time complexity: O(1)
[中]如果键包含散列,则检索与指定字段关联的值。
如果未找到字段或键不存在,则返回一个特殊的“nil”值。
时间复杂度:O(1)
代码示例来源:origin: apache/storm
@Override
public byte[] hget(byte[] key, byte[] field) {
return jedis.hget(key, field);
}
代码示例来源:origin: sohutv/cachecloud
@Override
public String execute(Jedis connection) {
return connection.hget(key, field);
}
}.run(key);
代码示例来源:origin: sohutv/cachecloud
@Override
public byte[] execute(Jedis connection) {
return connection.hget(key, field);
}
}.runBinary(key);
代码示例来源:origin: yu199195/hmily
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: yu199195/myth
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: yu199195/Raincat
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: testcontainers/testcontainers-java
@Override
public <T> Optional<T> get(String key, Class<T> expectedClass) {
String foundJson = this.jedis.hget(this.cacheName, key);
if (foundJson == null) {
return Optional.empty();
}
return Optional.of(gson.fromJson(foundJson, expectedClass));
}
}
代码示例来源:origin: sohutv/cachecloud
@Override
public byte[] hget(byte[] key, byte[] field) {
Jedis j = getShard(key);
return j.hget(key, field);
}
代码示例来源:origin: sohutv/cachecloud
@Override
public String hget(String key, String field) {
Jedis j = getShard(key);
return j.hget(key, field);
}
代码示例来源:origin: sohutv/cachecloud
public byte[] execute(Jedis connection) {
return connection.hget(keyByte, SafeEncoder.encode(field));
}
}.runBinary(keyByte);
代码示例来源:origin: yu199195/hmily
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisSentinelPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: yu199195/Raincat
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisSentinelPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: qiujiayu/AutoLoadCache
@Override
public byte[] hget(byte[] key, byte[] field) {
Jedis jedis = shardedJedis.getShard(key);
return jedis.hget(key, field);
}
代码示例来源:origin: yu199195/myth
@Override
public String hget(final String key, final String item) {
try (Jedis jedis = jedisSentinelPool.getResource()) {
return jedis.hget(key, item);
}
}
代码示例来源:origin: code4craft/webmagic
private Request getExtrasInItem(Jedis jedis, String url, Task task)
{
String key = getItemKey(task);
String field = DigestUtils.shaHex(url);
byte[] bytes = jedis.hget(key.getBytes(), field.getBytes());
if(bytes != null)
return JSON.parseObject(new String(bytes), Request.class);
return new Request(url);
}
}
代码示例来源:origin: signalapp/Signal-Server
public Optional<ClientContact> get(byte[] token) {
try (Jedis jedis = redisPool.getWriteResource()) {
byte[] result = jedis.hget(DIRECTORY_KEY, token);
if (result == null) {
return Optional.empty();
}
TokenValue tokenValue = objectMapper.readValue(result, TokenValue.class);
return Optional.of(new ClientContact(token, tokenValue.relay, tokenValue.voice, tokenValue.video));
} catch (IOException e) {
logger.warn("JSON Error", e);
return Optional.empty();
}
}
代码示例来源:origin: Netflix/conductor
@Override
public String hget(String key, String field) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.hget(key, field);
} finally {
if (jedis != null)
jedis.close();
}
}
代码示例来源:origin: code4craft/webmagic
@Override
public synchronized Request poll(Task task) {
Jedis jedis = pool.getResource();
try {
String url = jedis.lpop(getQueueKey(task));
if (url == null) {
return null;
}
String key = ITEM_PREFIX + task.getUUID();
String field = DigestUtils.shaHex(url);
byte[] bytes = jedis.hget(key.getBytes(), field.getBytes());
if (bytes != null) {
Request o = JSON.parseObject(new String(bytes), Request.class);
return o;
}
Request request = new Request(url);
return request;
} finally {
pool.returnResource(jedis);
}
}
代码示例来源:origin: jfinal/jfinal
/**
* 返回哈希表 key 中给定域 field 的值。
*/
@SuppressWarnings("unchecked")
public <T> T hget(Object key, Object field) {
Jedis jedis = getJedis();
try {
return (T)valueFromBytes(jedis.hget(keyToBytes(key), fieldToBytes(field)));
}
finally {close(jedis);}
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] hGet(byte[] key, byte[] field) {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(field, "Field must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().hget(key, field)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().hget(key, field)));
return null;
}
return connection.getJedis().hget(key, field);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!