Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Murcache

A very primitive effectful LRU cache for Cats Effect with support for Scala.js and Scala Native without external dependencies.

Usage

Mill

// JVM
mvn"digital.junkie::murcache:0.0.1"
// Scala.js / Scala Native
mvn"digital.junkie::murcache::0.0.1"

sbt

// JVM
"digital.junkie" %% "murcache" % "0.0.1"
// Scala.js / Scala Native
"digital.junkie" %%% "murcache" % "0.0.1"

Example

import cats.effect.IO
import digital.junkie.murcache.MurCache

val program = for {
  cache <- MurCache.simple[IO, String, Int](
    default = key => IO.pure(key.length),
    maxSize = 2
  )
  first <- cache.get("hello")
  second <- cache.get("hello")
  _ <- cache.put("world", 99)
  third <- cache.get("world")
  _ <- cache.invalidate("hello")
} yield (first, second, third)

Roadmap

  • ✓ Basic implementation

  • ❏ Refine load cancellation: original fiber cancellation should not cancel subsequent waiters

  • ❏ Weight-based cache sizing

  • ❏ Passive time based eviction

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages