Class CacheTestSupport.TestClock
java.lang.Object
cloud.opencode.base.cache.testing.CacheTestSupport.TestClock
- Enclosing class:
CacheTestSupport
Controllable clock for testing time-dependent cache behavior
用于测试时间相关缓存行为的可控时钟
- Since:
- JDK 25, opencode-base-cache V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TestClock
public TestClock()Creates a TestClock at the current time | 创建当前时间的测试时钟 -
TestClock
Creates a TestClock at the specified time | 创建指定时间的测试时钟- Parameters:
initialTime- the initial time | 初始时间
-
-
Method Details
-
millis
public long millis()Get current time in milliseconds 获取当前时间(毫秒)- Returns:
- current time | 当前时间
-
advance
Advance time by duration 按时长推进时间- Parameters:
duration- duration to advance | 推进时长
-
setTime
Set time to specific instant 设置为特定时刻- Parameters:
instant- the instant | 时刻
-
setTime
public void setTime(long millis) Set time in milliseconds 设置时间(毫秒)- Parameters:
millis- time in milliseconds | 毫秒时间
-