Skip to content

Commit

Permalink
Update changelog, and README to highlight removal of FakeTimeSource.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed May 26, 2022
1 parent eb16022 commit 38c9699
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Change Log

## 0.6.0
## Unreleased

### Changed

- Time Source can be provided externally
- `fakeTimeSource` in `Cache.Builder` has been renamed to `timeSource`, and the `FakeTimeSource` implementation has been removed (still available in our tests) - [#20](https://github.com/ReactiveCircus/cache4k/pull/20)
- Kotlin 1.6.21.

## 0.5.0

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ cache.invalidateAll()

### Unit testing cache expirations

To test logic that depends on cache expiration, pass in a `FakeTimeSource` when building a `Cache`
To test logic that depends on cache expiration, pass in a fake `TimeSource` implementation when building a `Cache`
so you can programmatically advance the reading of the time source:

```kotlin
Expand Down Expand Up @@ -224,6 +224,8 @@ fun cacheEntryEvictedAfterExpiration() {
}
```

A sample `FakeTimeSource` implementation can be found in [our tests](https://github.com/ReactiveCircus/cache4k/blob/8376a5f6198b3d8f82f42184fd1cabe4aa08e754/cache4k/src/commonTest/kotlin/io/github/reactivecircus/cache4k/FakeTimeSource.kt).

## Credits

The library was ported from a kotlin / JVM cache which I contributed to [dropbox/Store](https://github.com/dropbox/Store) to help unblock Store's multiplatform support (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlin.time.DurationUnit
*
* Implementation is identical to [kotlin.time.TestTimeSource] except the internal [reading] is an [AtomicLong].
*/
public class FakeTimeSource : AbstractLongTimeSource(unit = DurationUnit.NANOSECONDS) {
class FakeTimeSource : AbstractLongTimeSource(unit = DurationUnit.NANOSECONDS) {

private val reading = atomic(0L)

Expand Down

0 comments on commit 38c9699

Please sign in to comment.