本文整理了Java中redis.clients.jedis.Jedis.substr()
方法的一些代码示例,展示了Jedis.substr()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.substr()
方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:substr
[英]Return a subset of the string from offset start to offset end (both offsets are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So -1 means the last char, -2 the penultimate and so forth.
The function handles out of range requests without raising an error, but just limiting the resulting range to the actual length of the string.
Time complexity: O(start+n) (with start being the start index and n the total length of the requested range). Note that the lookup part of this command is O(1) so for small strings this is actually an O(1) command.
[中]从偏移开始到偏移结束返回字符串的子集(两个偏移都包含在内)。负偏移量可用于提供从字符串末尾开始的偏移量。So-1表示最后一个字符,-2表示倒数第二个字符,依此类推。
该函数在不引发错误的情况下处理超出范围的请求,但仅将结果范围限制为字符串的实际长度。
时间复杂度:O(start+n)(start是开始索引,n是请求范围的总长度)。请注意,该命令的查找部分是O(1),因此对于小字符串,这实际上是一个O(1)命令。
代码示例来源:origin: sohutv/cachecloud
@Override
public byte[] execute(Jedis connection) {
return connection.substr(key, start, end);
}
}.runBinary(key);
代码示例来源:origin: sohutv/cachecloud
@Override
public String execute(Jedis connection) {
return connection.substr(key, start, end);
}
}.run(key);
代码示例来源:origin: sohutv/cachecloud
public byte[] execute(Jedis connection) {
return connection.substr(keyByte, start, end);
}
}.runBinary(keyByte);
代码示例来源:origin: sohutv/cachecloud
@Override
public byte[] substr(byte[] key, int start, int end) {
Jedis j = getShard(key);
return j.substr(key, start, end);
}
代码示例来源:origin: sohutv/cachecloud
@Override
public String substr(String key, int start, int end) {
Jedis j = getShard(key);
return j.substr(key, start, end);
}
代码示例来源:origin: Netflix/conductor
@Override
public String substr(String key, int start, int end) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.substr(key, start, end);
} finally {
if (jedis != null)
jedis.close();
}
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] getRange(byte[] key, long start, long end) {
Assert.notNull(key, "Key must not be null!");
if (start > Integer.MAX_VALUE || end > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Start and end must be less than Integer.MAX_VALUE for getRange in Jedis.");
}
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().substr(key, (int) start, (int) end),
JedisConverters.stringToBytes()));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().substr(key, (int) start, (int) end),
JedisConverters.stringToBytes()));
return null;
}
return connection.getJedis().substr(key, (int) start, (int) end);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: io.leopard/leopard-redis
@Override
public Object execute(Jedis jedis) {
return jedis.substr(key, start, end);
}
});
代码示例来源:origin: yrain/smart-cache
@Override
String doInJedis(Jedis jedis) {
return jedis.substr(key, start, end);
}
});
代码示例来源:origin: yrain/smart-cache
@Override
byte[] doInJedis(Jedis jedis) {
return jedis.substr(key, start, end);
}
});
代码示例来源:origin: io.leopard/leopard-redis
@Override
public String substr(String key, int start, int end) {
return jedis.substr(key, start, end);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public String execute(Jedis connection) {
return connection.substr(key, start, end);
}
}.run(key);
代码示例来源:origin: apache/servicemix-bundles
@Override
public byte[] execute(Jedis connection) {
return connection.substr(key, start, end);
}
}.runBinary(key);
代码示例来源:origin: io.leopard/leopard-redis
@Override
public String substr(String key, int start, int end) {
return jedis.substr(key, start, end);
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public String substr(String key, int start, int end) {
String command = "substr";
return instrumented(command, () -> delegated.substr(key, start, end));
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public byte[] substr(final byte[] key, final int start, final int end) {
Jedis j = getShard(key);
return j.substr(key, start, end);
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public byte[] substr(byte[] key, int start, int end) {
String command = "substr";
return instrumented(command, () -> delegated.substr(key, start, end));
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public String substr(final String key, final int start, final int end) {
Jedis j = getShard(key);
return j.substr(key, start, end);
}
代码示例来源:origin: org.tinygroup/org.tinygroup.jedis
public String substr(String key, int start, int end) {
Jedis j = getReadShard(key);
return j.substr(key, start, end);
}
代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence
@Override
public String substr(String key, int start, int end) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.substr(key, start, end);
} finally {
if (jedis != null)
jedis.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!