Skip to content

Releases: evolution-gaming/scache

v5.1.2

03 Jul 13:35
1a585db
Compare
Choose a tag to compare

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

Full Changelog: v5.1.1...v5.1.2

v5.1.1

09 Jun 19:55
10f2320
Compare
Choose a tag to compare

What's Changed

Full Changelog: v5.1.0...v5.1.1

v4.6.1

09 Jun 19:55
137f0bb
Compare
Choose a tag to compare

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

09 Jun 19:55
04ebf7a
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.9.0...v3.9.1

v3.7.3

09 Jun 19:54
e22c76f
Compare
Choose a tag to compare

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

07 Jun 12:45
09d3af2
Compare
Choose a tag to compare

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

07 Jun 12:43
ed16561
Compare
Choose a tag to compare

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

01 Jun 08:19
f43cf2a
Compare
Choose a tag to compare

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

Full Changelog: v5.0.0...v5.1.0

v3.9.0

01 Jun 08:18
6b34a41
Compare
Choose a tag to compare

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

Full Changelog: v3.8.0...v3.9.0

v5.0.0

25 May 15:15
4c3e926
Compare
Choose a tag to compare

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* and remove interaction: if remove is performed while getOrUpdate* 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 of getOrUpdate*, put and `remove.

What's Changed

Full Changelog: v4.4.1...v5.0.0