-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support injected clock #343
Comments
Thanks for the suggestion, you are right, that would be a great addition to the mock. Will include this feature into the plan for the autumn term |
Clock injection is implemented in version 1.1.3 See README for details |
Does the server need to have the clock updated each time I wish to change the time? Or will the server be reactive to the clock being mutated? For example: var time = Instant.EPOCH
server.setClock(object: Clock {
override fun instant() = time
...
})
jedis.setex("key1", 20, "v1");
time += Duration.ofSeconds(30)
jedis.exists("key1") shouldBe false |
Both approaches are possible, but please mark shared mutable |
Oh, I see. Thanks! |
It would be nice to be able to inject a clock into the fake server so we can test expiry operations.
The text was updated successfully, but these errors were encountered: