RedisImpl implements Redis { public void timeout(Duration timeout) { timeoutInMs = (int) timeout.toMillis(); pool.checkoutTimeout(timeout); } RedisImpl(String name); void timeout(Duration timeout); void slowOperationThreshold(Duration threshold); void close(); @Override String get(String key); byte[] getBytes(String key); @Override RedisSet set(); @Override boolean set(String key, String value, Duration expiration, boolean onlyIfAbsent); boolean set(String key, byte[] value, Duration expiration, boolean onlyIfAbsent); @Override void expire(String key, Duration expiration); @Override long del(String... keys); @Override long increaseBy(String key, long increment); @Override Map<String, String> multiGet(String... keys); Map<String, byte[]> multiGetBytes(String... keys); @Override void multiSet(Map<String, String> values); void multiSet(Map<String, byte[]> values, Duration expiration); @Override RedisHash hash(); @Override RedisList list(); @Override void forEach(String pattern, Consumer<String> consumer); @Override RedisAdmin admin(); long[] expirationTime(String... keys); void publish(String channel, byte[] message); public Pool<RedisConnection> pool; public RedisHost host; }
@Test void timeout() { var timeout = Duration.ofSeconds(5); redis.timeout(timeout); assertThat(redis.timeoutInMs).isEqualTo(timeout.toMillis()); }