-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a04dd98
commit 85324a1
Showing
22 changed files
with
692 additions
and
573 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @permutive-engineering/developer-experience |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@DESCRIPTION@ | ||
|
||
```scala mdoc:toc | ||
``` | ||
|
||
## Installation | ||
|
||
Add the following line to your `build.sbt` file: | ||
|
||
```sbt | ||
libraryDependencies += "@ORGANIZATION@" %% "@NAME@" % "@VERSION@" | ||
``` | ||
|
||
The library is published for Scala versions: @SUPPORTED_SCALA_VERSIONS@. | ||
|
||
## Usage | ||
|
||
# Refreshable | ||
|
||
`Refreshable` lives in the [Typelevel](https://typelevel.org/) Scala ecosystem | ||
and offers a `Refreshable` type that operates like a cache of size 1 with a | ||
background fiber that periodically refreshes the stored value. Use it when you | ||
have criticial data that needs to be cached and you would rather read stale data | ||
in the event that refreshing the data fails. | ||
|
||
```scala | ||
trait Refreshable[F[_], A] { | ||
|
||
/** Get the unwrapped value of `A` | ||
*/ | ||
def value: F[A] = get.map(_.value) | ||
|
||
/** Get the value of `A` wrapped in a status | ||
*/ | ||
def get: F[CachedValue[A]] | ||
|
||
/** Cancel refreshing | ||
*/ | ||
def cancel: F[Boolean] | ||
|
||
/** Restart refreshing | ||
*/ | ||
def restart: F[Boolean] | ||
} | ||
|
||
sealed trait CachedValue[A] { | ||
def value: A | ||
} | ||
|
||
object CachedValue { | ||
case class Success[A](value: A) extends CachedValue[A] | ||
case class Error[A](value: A, error: Throwable) extends CachedValue[A] | ||
case class Cancelled[A](value: A) extends CachedValue[A] | ||
} | ||
``` | ||
|
||
## Contributors to this project | ||
|
||
@CONTRIBUTORS_TABLE@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Don't edit this file! | ||
# It is automatically updated after every release of https://github.com/alejandrohdezma/sbt-ci | ||
# If you want to suggest a change, please open a PR or issue in that repository | ||
|
||
# This file contains the template for the "auto-generated release notes" | ||
|
||
changelog: | ||
exclude: | ||
labels: | ||
- ":chart_with_upwards_trend: dependency-update" | ||
authors: | ||
- dependabot | ||
categories: | ||
- title: "⚠️ Breaking changes" | ||
labels: | ||
- ":warning: breaking" | ||
- title: "🚀 New features" | ||
labels: | ||
- ":rocket: feature" | ||
- title: "📘 Documentation updates" | ||
labels: | ||
- ":blue_book: documentation" | ||
- title: "🐛 Bug fixes" | ||
labels: | ||
- ":beetle: bug" | ||
- title: Other Changes | ||
labels: | ||
- "*" |
Oops, something went wrong.