org.springframework.data.redis.core.BoundHashOperations.expire()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.springframework.data.redis.core.BoundHashOperations.expire()方法的一些代码示例,展示了BoundHashOperations.expire()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoundHashOperations.expire()方法的具体详情如下:
包路径:org.springframework.data.redis.core.BoundHashOperations
类名称:BoundHashOperations
方法名:expire

BoundHashOperations.expire介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

代码示例来源:origin: spring-projects/spring-session

@Test
public void onExpirationUpdatedSetExpireSession() throws Exception {
  String sessionKey = this.policy.getSessionKey(this.session.getId());
  this.policy.onExpirationUpdated(null, this.session);
  verify(this.sessionRedisOperations).boundHashOps(sessionKey);
  verify(this.hashOperations).expire(
      this.session.getMaxInactiveInterval().plusMinutes(5).getSeconds(),
      TimeUnit.SECONDS);
}

代码示例来源:origin: spring-projects/spring-session

@Test
public void flushModeSetMaxInactiveIntervalInSeconds() {
  given(this.redisOperations.boundHashOps(anyString()))
      .willReturn(this.boundHashOperations);
  given(this.redisOperations.boundSetOps(anyString()))
      .willReturn(this.boundSetOperations);
  given(this.redisOperations.boundValueOps(anyString()))
      .willReturn(this.boundValueOperations);
  this.redisRepository.setRedisFlushMode(RedisFlushMode.IMMEDIATE);
  RedisSession session = this.redisRepository.createSession();
  reset(this.boundHashOperations);
  session.setMaxInactiveInterval(Duration.ofSeconds(1));
  verify(this.boundHashOperations).expire(anyLong(), any(TimeUnit.class));
}

代码示例来源:origin: spring-projects/spring-session

@Test
public void saveJavadocSummary() {
  RedisSession session = this.redisRepository.createSession();
  String sessionKey = "spring:session:sessions:" + session.getId();
  String backgroundExpireKey = "spring:session:expirations:"
      + RedisSessionExpirationPolicy.roundUpToNextMinute(
          RedisSessionExpirationPolicy.expiresInMillis(session));
  String destroyedTriggerKey = "spring:session:sessions:expires:" + session.getId();
  given(this.redisOperations.boundHashOps(sessionKey))
      .willReturn(this.boundHashOperations);
  given(this.redisOperations.boundSetOps(backgroundExpireKey))
      .willReturn(this.boundSetOperations);
  given(this.redisOperations.boundValueOps(destroyedTriggerKey))
      .willReturn(this.boundValueOperations);
  this.redisRepository.save(session);
  // the actual data in the session expires 5 minutes after expiration so the data
  // can be accessed in expiration events
  // if the session is retrieved and expired it will not be returned since
  // findById checks if it is expired
  long fiveMinutesAfterExpires = session.getMaxInactiveInterval().plusMinutes(5)
      .getSeconds();
  verify(this.boundHashOperations).expire(fiveMinutesAfterExpires,
      TimeUnit.SECONDS);
  verify(this.boundSetOperations).expire(fiveMinutesAfterExpires, TimeUnit.SECONDS);
  verify(this.boundSetOperations).add("expires:" + session.getId());
  verify(this.boundValueOperations).expire(1800L, TimeUnit.SECONDS);
  verify(this.boundValueOperations).append("");
}

代码示例来源:origin: spring-projects/spring-session

@Test
public void saveJavadoc() {
  RedisSession session = this.redisRepository.new RedisSession(this.cached);
  session.setLastAccessedTime(session.getLastAccessedTime());
  given(this.redisOperations.boundHashOps("spring:session:sessions:session-id"))
      .willReturn(this.boundHashOperations);
  given(this.redisOperations
      .boundSetOps("spring:session:expirations:1404361860000"))
          .willReturn(this.boundSetOperations);
  given(this.redisOperations
      .boundValueOps("spring:session:sessions:expires:session-id"))
          .willReturn(this.boundValueOperations);
  this.redisRepository.save(session);
  // the actual data in the session expires 5 minutes after expiration so the data
  // can be accessed in expiration events
  // if the session is retrieved and expired it will not be returned since
  // findById checks if it is expired
  verify(this.boundHashOperations).expire(
      session.getMaxInactiveInterval().plusMinutes(5).getSeconds(),
      TimeUnit.SECONDS);
}

代码示例来源:origin: spring-projects/spring-session

.expire(fiveMinutesAfterExpires, TimeUnit.SECONDS);

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Boolean expire(long timeout, TimeUnit unit) {
  return hashOps.expire(timeout, unit);
}

相关文章