Releases: evolution-gaming/scache
v5.1.2
Scala 3 support
This release brings support for Scala 3! Check the Setup paragraph in readme to see how to use this library.
What's Changed
- Update scala-library to 2.13.11 by @scala-steward in #216
- Update scala-library to 2.12.18 by @scala-steward in #215
- feat: cross compile to Scala 3 by @kpodsiad in #221
Full Changelog: v5.1.1...v5.1.2
v5.1.1
What's Changed
- Update sbt-scoverage to 2.0.8 by @scala-steward in #206
- Update sbt to 1.9.0 by @scala-steward in #205
- Add missing
name
label tomodify
metric by @i-surkov in #211
Full Changelog: v5.1.0...v5.1.1
v4.6.1
Compatibility notes
This release is binary compatible with 4.x.x
series, and is created to facilitate the migration to the binary-incompatible 5.x.x
series.
What's Changed
Full Changelog: v4.6.0...v4.6.1
v3.9.1
v3.7.3
Compatibility notes
This release is binary compatible with 3.7.x
series, and is created to facilitate the migration to the binary-incompatible 3.8.x
/3.9.x
series.
What's Changed
Full Changelog: v3.7.2...v3.7.3
v4.6.0
Compatibility notes
This release is binary compatible with 4.x.x
series, and is created to facilitate the migration to the binary-incompatible 5.x.x
series.
It also backports the modify
function implementation from the 5.1.0
release, see release notes for details.
What's Changed
- Fix bug of counting optional loading for None as a failure by @Phill101 in #190
- Fix release race conditions and refactor core flows by @i-surkov in #192
- Update smetrics to 1.2.0, cats-helper to 3.5.0 by @i-surkov in #207
- Implement atomic modify function by @i-surkov in #209
Full Changelog: v4.4.1...v4.6.0
v3.7.2
Compatibility notes
This release is binary compatible with 3.7.x
series, and is created to facilitate the migration to the binary-incompatible 3.8.x
/3.9.x
series.
It also backports the modify
function implementation from the 3.9.0
release, see release notes for details.
What's Changed
- Fix bug of counting optional loading for None as a failure by @Phill101 in #191
- Fix release race conditions and refactor core flows by @i-surkov in #196
- Update smetrics to 0.4.2, cats-helper to 2.11.0 by @i-surkov in #208
- Implement atomic modify function by @i-surkov in #210
Full Changelog: v3.7.0...v3.7.2
v5.1.0
Atomic modify operation
The major change in this release is the addition of the new modify
method in Cache
interface:
def modify[A](key: K)(f: Option[V] => (A, Directive[F, V])): F[(A, Option[F[Unit]])]
where Directive[F, V]
is defined as
sealed trait Directive[+F[_], +V]
object Directive {
final case class Put[F[_], V](value: V, release: Option[F[Unit]]) extends Directive[F, V]
final case object Remove extends Directive[Nothing, Nothing]
final case object Ignore extends Directive[Nothing, Nothing]
}
Similarly to modify
in the cats effect Ref
, it allows to atomically modify a value under a specific key. The function f
passed to modify
allows to make a decision whether to put a new value, remove the key, or ignore it based on the current value or its absence.
Extension methods based on modify
were also added to facilitate the use in specific use-cases:
def update(key: K)(f: Option[V] => Directive[F, V])(implicit F: Functor[F]): F[Option[F[Unit]]]
def updatePresent(key: K)(f: V => V)(implicit F: Functor[F]): F[Boolean]
def updatePresentOpt(key: K)(f: V => Option[V])(implicit F: Functor[F]): F[Boolean]
def putStrict(key: K, value: V)(implicit F: Applicative[F]): F[Option[(V, F[Unit])]]
def putStrict(key: K, value: V, release: self.type#Release)(implicit F: Applicative[F]): F[Option[(V, F[Unit])]]
For detailed semantics of those methods, refer to their scaladoc.
What's Changed
- Update scalatest to 3.2.16 by @scala-steward in #194
- Update sbt-ci-release to 1.5.12 by @scala-steward in #189
- Update cats-core to 2.9.0 by @scala-steward in #160
- Update sbt-coveralls to 1.3.8 by @scala-steward in #187
- Update sbt-scoverage to 2.0.7 by @scala-steward in #180
- Update scala-library to 2.13.10 by @scala-steward in #153
- Update sbt to 1.8.3 by @i-surkov in #199
- Implement modify by @i-surkov in #202
Full Changelog: v5.0.0...v5.1.0
v3.9.0
Atomic modify operation
The major change in this release is the addition of the new modify
method in Cache
interface:
def modify[A](key: K)(f: Option[V] => (A, Directive[F, V])): F[(A, Option[F[Unit]])]
where Directive[F, V]
is defined as
sealed trait Directive[+F[_], +V]
object Directive {
final case class Put[F[_], V](value: V, release: Option[F[Unit]]) extends Directive[F, V]
final case object Remove extends Directive[Nothing, Nothing]
final case object Ignore extends Directive[Nothing, Nothing]
}
Similarly to modify
in the cats effect Ref
, it allows to atomically modify a value under a specific key. The function f
passed to modify
allows to make a decision whether to put a new value, remove the key, or ignore it based on the current value or its absence.
Extension methods based on modify
were also added to facilitate the use in specific use-cases:
def update(key: K)(f: Option[V] => Directive[F, V])(implicit F: Functor[F]): F[Option[F[Unit]]]
def updatePresent(key: K)(f: V => V)(implicit F: Functor[F]): F[Boolean]
def updatePresentOpt(key: K)(f: V => Option[V])(implicit F: Functor[F]): F[Boolean]
def putStrict(key: K, value: V)(implicit F: Applicative[F]): F[Option[(V, F[Unit])]]
def putStrict(key: K, value: V, release: self.type#Release)(implicit F: Applicative[F]): F[Option[(V, F[Unit])]]
For detailed semantics of those methods, refer to their scaladoc.
What's Changed
- Run CI for CE2 branch by @i-surkov in #201
- Dependency updates by @i-surkov in #200
- Implement atomic modify function by @i-surkov in #204
Full Changelog: v3.8.0...v3.9.0
v5.0.0
Breaking changes
This major release updates cats-helper
dependency to 3.5.0
and smetrics
to 2.0.0
. APIs that used com.evolutiongaming.smetrics.MeasureDuration
now expect com.evolutiongaming.catshelper.MeasureDuration
. See smetrics
2.0.0 release notes for details.
Other notable changes
getOrUpdate*
andremove
interaction: ifremove
is performed whilegetOrUpdate*
effect is being evaluated, the value will be put in cache after the evaluation finishes. Before,getOrUpdate*
would return result of the calculation, but it would not be saved in cache.remove
will not return an effect corresponding to release of the value, if the value is still loading (but the release will still be performed). It will return the releasing effect resulting in the released value only if the value was already loaded in cache.put
is now executed faster in a highly-contentious scenarios: it will now give up much easier give up updating cache if encountered with concurrent changes being performed. Before, it would only finish executing when it succeeded writing the value, even if it meant retrying multiple times. That guarantee didn't bring much benefits, but hurt the performance.- A bug was fixed in which a
release
of some cache entries would be performed 0 or 2+ times in various scenarios involving concurrent execution ofgetOrUpdate*
,put
and `remove.
What's Changed
- Fix bug of counting optional loading for None as a failure by @Phill101 in #190
- Fix release race conditions and refactor core flows by @i-surkov in #192
- Update cats-effect to 3.4.11 by @scala-steward in #195
- Update smetrics to 2.0.0 by @Z1kkurat in #197
Full Changelog: v4.4.1...v5.0.0