本文整理匯總了Java中redis.clients.jedis.Pipeline.zscore方法的典型用法代碼示例。如果您正苦於以下問題:Java Pipeline.zscore方法的具體用法?Java Pipeline.zscore怎麽用?Java Pipeline.zscore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.clients.jedis.Pipeline
的用法示例。
在下文中一共展示了Pipeline.zscore方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: pipelineResponseWithData
import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
@Test
public void pipelineResponseWithData() {
jedis.zadd("zset", 1, "foo");
Pipeline p = jedis.pipelined();
Response<Double> score = p.zscore("zset", "foo");
p.sync();
assertNotNull(score.get());
}
示例2: pipelineResponseWithoutData
import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
@Test
public void pipelineResponseWithoutData() {
jedis.zadd("zset", 1, "foo");
Pipeline p = jedis.pipelined();
Response<Double> score = p.zscore("zset", "bar");
p.sync();
assertNull(score.get());
}
示例3: pauseTrigger
import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
/**
* Pause the trigger with the given key
* @param triggerKey the key of the trigger to be paused
* @param jedis a thread-safe Redis connection
* @throws JobPersistenceException if the desired trigger does not exist
*/
@Override
public void pauseTrigger(TriggerKey triggerKey, Jedis jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Pipeline pipe = jedis.pipelined();
Response<Boolean> exists = pipe.exists(triggerHashKey);
Response<Double> completedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.COMPLETED), triggerHashKey);
Response<String> nextFireTimeResponse = pipe.hget(triggerHashKey, TRIGGER_NEXT_FIRE_TIME);
Response<Double> blockedScore = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.BLOCKED), triggerHashKey);
pipe.sync();
if(!exists.get()){
return;
}
if(completedScore.get() != null){
// doesn't make sense to pause a completed trigger
return;
}
final long nextFireTime = nextFireTimeResponse.get() == null
|| nextFireTimeResponse.get().isEmpty() ? -1 : Long.parseLong(nextFireTimeResponse.get());
if(blockedScore.get() != null){
setTriggerState(RedisTriggerState.PAUSED_BLOCKED, (double) nextFireTime, triggerHashKey, jedis);
}
else{
setTriggerState(RedisTriggerState.PAUSED, (double) nextFireTime, triggerHashKey, jedis);
}
}
示例4: resumeTrigger
import redis.clients.jedis.Pipeline; //導入方法依賴的package包/類
/**
* Resume (un-pause) a {@link org.quartz.Trigger}
* @param triggerKey the key of the trigger to be resumed
* @param jedis a thread-safe Redis connection
*/
@Override
public void resumeTrigger(TriggerKey triggerKey, Jedis jedis) throws JobPersistenceException {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Pipeline pipe = jedis.pipelined();
Response<Boolean> exists = pipe.sismember(redisSchema.triggersSet(), triggerHashKey);
Response<Double> isPaused = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED), triggerHashKey);
Response<Double> isPausedBlocked = pipe.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED_BLOCKED), triggerHashKey);
pipe.sync();
if(!exists.get()){
// Trigger does not exist. Nothing to do.
return;
}
if(isPaused.get() == null && isPausedBlocked.get() == null){
// Trigger is not paused. Nothing to do.
return;
}
OperableTrigger trigger = retrieveTrigger(triggerKey, jedis);
final String jobHashKey = redisSchema.jobHashKey(trigger.getJobKey());
final Date nextFireTime = trigger.getNextFireTime();
if(nextFireTime != null){
if(jedis.sismember(redisSchema.blockedJobsSet(), jobHashKey)){
setTriggerState(RedisTriggerState.BLOCKED, (double) nextFireTime.getTime(), triggerHashKey, jedis);
}
else{
setTriggerState(RedisTriggerState.WAITING, (double) nextFireTime.getTime(), triggerHashKey, jedis);
}
}
applyMisfire(trigger, jedis);
}