org.springframework.data.redis.connection.RedisConnection.ttl()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(159)

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

RedisConnection.ttl介绍

暂无

代码示例

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

@Override
public Long ttl(byte[] key, TimeUnit timeUnit) {
  return convertAndReturn(delegate.ttl(key, timeUnit), identityConverter);
}

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

@Override
public Long ttl(byte[] key) {
  return convertAndReturn(delegate.ttl(key), identityConverter);
}

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

@Override
public Long getExpire(K key) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> connection.ttl(rawKey), true);
}

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

@Override
public Long getExpire(K key, final TimeUnit timeUnit) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> {
    try {
      return connection.pTtl(rawKey, timeUnit);
    } catch (Exception e) {
      // Driver may not support pTtl or we may be running on Redis 2.4
      return connection.ttl(rawKey, timeUnit);
    }
  }, true);
}

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

return connection.ttl(key);

代码示例来源:origin: zhangxd1989/springboot-dubbox

/**
 * 查询在这个时间段内即将过期的key
 *
 * @param key  the key
 * @param time the time
 * @return the list
 */
public List<String> willExpire(final String key, final long time) {
  final List<String> keysList = new ArrayList<>();
  redisTemplate.execute((RedisCallback<List<String>>) connection -> {
    Set<String> keys = redisTemplate.keys(key + "*");
    for (String key1 : keys) {
      Long ttl = connection.ttl(key1.getBytes(DEFAULT_CHARSET));
      if (0 <= ttl && ttl <= 2 * time) {
        keysList.add(key1);
      }
    }
    return keysList;
  });
  return keysList;
}

代码示例来源:origin: 1991wangliang/tx-lcn

@Override
public Long ttl(byte[] key) {
  return redisConnection.ttl(key);
}

代码示例来源:origin: 1991wangliang/tx-lcn

@Override
public Long ttl(byte[] key, TimeUnit timeUnit) {
  return redisConnection.ttl(key, timeUnit);
}

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

@Override
public Long ttl(byte[] key) {
  return convertAndReturn(delegate.ttl(key), identityConverter);
}

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

@Override
public Long ttl(byte[] key, TimeUnit timeUnit) {
  return convertAndReturn(delegate.ttl(key, timeUnit), identityConverter);
}

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

@Override
public Long ttl(byte[] key, TimeUnit timeUnit) {
  return convertAndReturn(delegate.ttl(key, timeUnit), identityConverter);
}

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

@Override
public Long ttl(byte[] key) {
  return convertAndReturn(delegate.ttl(key), identityConverter);
}

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

@Override
public Long getExpire(K key) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> connection.ttl(rawKey), true);
}

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

@Override
public Long getExpire(K key) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> connection.ttl(rawKey), true);
}

代码示例来源:origin: liuht777/Taroco

/**
 * 查询在这个时间段内即将过期的key
 *
 * @param key  the key
 * @param time the time
 * @return the list
 */
public List<String> willExpire(final String key, final long time) {
  final List<String> keysList = new ArrayList<>();
  redisTemplate.execute((RedisCallback<List<String>>) connection -> {
    Set<String> keys = redisTemplate.keys(key + "*");
    for (String key1 : keys) {
      Long ttl = connection.ttl(key1.getBytes(DEFAULT_CHARSET));
      if (0 <= ttl && ttl <= 2 * time) {
        keysList.add(key1);
      }
    }
    return keysList;
  });
  return keysList;
}

代码示例来源:origin: com.y3tu/y3tu-tool-web

/**
 * 查询在这个时间段内即将过期的key
 *
 * @param key  the key
 * @param time the time
 * @return the list
 */
public List<String> willExpire(final String key, final long time) {
  final List<String> keysList = new ArrayList<>();
  redisTemplate.execute((RedisCallback<List<String>>) connection -> {
    Set<String> keys = redisTemplate.keys(key + "*");
    for (String key1 : keys) {
      Long ttl = connection.ttl(key1.getBytes(DEFAULT_CHARSET));
      if (0 <= ttl && ttl <= 2 * time) {
        keysList.add(key1);
      }
    }
    return keysList;
  });
  return keysList;
}

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

@Override
public Long getExpire(K key, final TimeUnit timeUnit) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> {
    try {
      return connection.pTtl(rawKey, timeUnit);
    } catch (Exception e) {
      // Driver may not support pTtl or we may be running on Redis 2.4
      return connection.ttl(rawKey, timeUnit);
    }
  }, true);
}

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

@Override
public Long getExpire(K key, final TimeUnit timeUnit) {
  byte[] rawKey = rawKey(key);
  return execute(connection -> {
    try {
      return connection.pTtl(rawKey, timeUnit);
    } catch (Exception e) {
      // Driver may not support pTtl or we may be running on Redis 2.4
      return connection.ttl(rawKey, timeUnit);
    }
  }, true);
}

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

return connection.ttl(key);

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

return connection.ttl(key);

相关文章

微信公众号

最新文章

更多

RedisConnection类方法