Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,36 +83,30 @@

## cacheable

A cache like Spring `@Cacheable` and `@cacheEvict` based on zio. It has no implementation of storage media.
A cache like Spring `@Cacheable` and `@cacheEvict` based on zio. It has no implementation of storage media. (not support Scala2.11.x)

- `@cacheable` / `Cache.apply`
- `@cacheEvict` / `Cache.evict`

```scala
// cache API, include dependencies: zio, zio-streams, zio-logging
"org.bitlap" %% "smt-cacheable" % "<VERSION>" // not support Scala2.11.x
"org.bitlap" %% "smt-cacheable" % "<VERSION>"
```

## cacheable-redis

A distributed cache based on zio and zio-redis. It needs `cacheable` module.
A distributed cache based on zio and zio-redis. It depends on `cacheable` module.

> TODO Not unavailable, no distributed lock
> TODO Not unavailable

```scala
// distributed cache, include dependencies: zio-redis, config, zio-schema, zio-schema-json, optional (zio-schema-derivation for case class)
// dependsOn `smt-cacheable`
"org.bitlap" %% "smt-cacheable-redis" % "<VERSION>" // not support Scala2.11.x
```

## cacheable-caffeine

A memory cache based on zio and caffeine. It needs `cacheable` module.

A memory cache based on zio and caffeine. It needs `cacheable` module. (not support Scala2.11.x)
```scala
// local cache, include dependencies: config, caffeine
// dependsOn `smt-cacheable`
"org.bitlap" %% "smt-cacheable-caffeine" % "<VERSION>" // not support Scala2.11.x
"org.bitlap" %% "smt-cacheable-caffeine" % "<VERSION>"
```

The artefacts have been uploaded to Maven Central. Importing the library into your build system (e.g gradle, sbt), is not enough. You need to follow an extra step.
Expand Down Expand Up @@ -140,7 +134,7 @@ you must still enable the compiler flag `-Ymacro-annotations`.
This project is developed using JetBrains IDEA.
Thanks to JetBrains for providing me with a free license, which is a strong support for me.

[Stage]: https://img.shields.io/badge/Project%20Stage-Experimental-yellow.svg
[Stage]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg
[Badge-CI]: https://github.com/bitlap/smt/actions/workflows/ScalaCI.yml/badge.svg
[Badge-Scaladex]: https://index.scala-lang.org/bitlap/smt/smt-annotations/latest.svg?platform=jvm
[Badge-Jetbrains]: https://img.shields.io/jetbrains/plugin/v/17202-scala-macro-tools
Expand Down
12 changes: 4 additions & 8 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,18 @@

基于zio和zio-redis的分布式缓存实现,内部依赖`cacheable`。

> TODO,目前不可用,无分布式锁
> TODO,目前不可用

```scala
// 分布式缓存, 内部包含的依赖: zio-redis, config, zio-schema, zio-schema-json, 可选的 (zio-schema-derivation用于样例类序列化)
// 依赖于`smt-cacheable`
"org.bitlap" %% "smt-cacheable-redis" % "<VERSION>" // 不支持Scala2.11.x
```

## cacheable-caffeine

基于zio和caffeine的内存缓存实现,内部依赖`cacheable`。
基于zio和caffeine的内存缓存实现,内部依赖`cacheable`。(不支持Scala2.11.x)

```scala
// 本地缓存, 内部包含的依赖: config, caffeine
// 依赖于`smt-cacheable`
"org.bitlap" %% "smt-cacheable-caffeine" % "<VERSION>" // 不支持Scala2.11.x
"org.bitlap" %% "smt-cacheable-caffeine" % "<VERSION>"
```

该库已发布到maven中央仓库,请使用最新版本。仅将本库导入构建系统(例如gradle、sbt)是不够的。你需要多走一步。
Expand All @@ -142,7 +138,7 @@ addCompilerPlugin("org.scalamacros" % "paradise_<your-scala-version>" % "<plugin
This project is developed using JetBrains IDEA.
Thanks to JetBrains for providing me with a free license, which is a strong support for me.

[Stage]: https://img.shields.io/badge/Project%20Stage-Experimental-yellow.svg
[Stage]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg
[Badge-CI]: https://github.com/bitlap/smt/actions/workflows/ScalaCI.yml/badge.svg
[Badge-Scaladex]: https://index.scala-lang.org/bitlap/smt/smt-annotations/latest.svg?platform=jvm
[Badge-Jetbrains]: https://img.shields.io/jetbrains/plugin/v/17202-scala-macro-tools
Expand Down
21 changes: 12 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ThisBuild / resolvers ++= Seq(
lazy val scala212 = "2.12.14"
lazy val scala211 = "2.11.12"
lazy val scala213 = "2.13.8"
lazy val lastVersionForExamples = "0.5.2"
lazy val lastVersionForExamples = "0.7.3"

lazy val configVersion = "1.4.2"
lazy val scalatestVersion = "3.2.12"
Expand All @@ -24,7 +24,6 @@ lazy val scalaLoggingVersion = "3.9.5"
lazy val playJsonVersion = "2.7.4"
lazy val log4jVersion = "2.17.2"
lazy val jacksonScalaVersion = "2.13.3"
lazy val jraftVersion = "1.3.9"
lazy val scalaCollectionCompatVersion = "2.7.0"

lazy val commonSettings =
Expand All @@ -33,9 +32,9 @@ lazy val commonSettings =
startYear := Some(2022),
scalaVersion := scala213,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
),
Compile / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
Expand All @@ -59,7 +58,7 @@ lazy val `smt-cacheable` = (project in file("smt-cacheable"))
name := "smt-cacheable",
crossScalaVersions := List(scala213, scala212),
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion, // FIXME we should use compile or provide ???
"dev.zio" %% "zio" % zioVersion % Provided,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-logging" % zioLoggingVersion
)
Expand Down Expand Up @@ -89,7 +88,7 @@ lazy val `smt-cacheable-redis` = (project in file("smt-cacheable-redis"))
name := "smt-cacheable-redis",
crossScalaVersions := List(scala213, scala212),
libraryDependencies ++= Seq(
"dev.zio" %% "zio-redis" % zioRedisVersion,
"dev.zio" %% "zio-redis" % zioRedisVersion % Provided,
"com.typesafe" % "config" % configVersion,
"dev.zio" %% "zio-schema" % zioSchemaVersion,
"dev.zio" %% "zio-schema-json" % zioSchemaVersion,
Expand Down Expand Up @@ -217,7 +216,9 @@ lazy val `scala2-13` = (project in file("examples/scala2-13"))
"org.bitlap" %% "smt-tools" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-core" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-redis" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-caffeine" % lastVersionForExamples
"org.bitlap" %% "smt-cacheable-caffeine" % lastVersionForExamples,
"dev.zio" %% "zio-redis" % zioRedisVersion,
"dev.zio" %% "zio" % zioVersion
)
)
.settings(
Expand All @@ -232,7 +233,9 @@ lazy val `scala2-12` = (project in file("examples/scala2-12"))
"org.bitlap" %% "smt-tools" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-core" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-redis" % lastVersionForExamples,
"org.bitlap" %% "smt-cacheable-caffeine" % lastVersionForExamples
"org.bitlap" %% "smt-cacheable-caffeine" % lastVersionForExamples,
"dev.zio" %% "zio-redis" % zioRedisVersion,
"dev.zio" %% "zio" % zioVersion
)
)
.settings(
Expand Down