diff --git a/README.md b/README.md index 6c94dc6..051c74e 100644 --- a/README.md +++ b/README.md @@ -36,22 +36,22 @@ as well as on your premise. - [synchronous and asynchronous APIs](#provided-apis) - [implements standard APIs defined by Play's `cacheApi` project](#provided-apis) -- support of [named caches](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#named-caches) -- [works with Guice](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/40-migration.md#runtime-time-dependency-injection) as well as [compile-time DI](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/40-migration.md#compile-time-dependency-injection) -- [getOrElse and getOrFuture operations](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-cacheapi) easing the use -- [wildcards in remove operation](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-cacheapi) -- support of collections: [sets](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-sets), [lists](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-lists), and [maps](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-maps) -- [increment and decrement operations](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md#use-of-cacheapi) -- [eager and lazy invocation policies](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#eager-and-lazy-invocation) waiting or not waiting for the result -- several [recovery policies](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#recovery-policy) and possibility of further customization -- support of [several configuration sources](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#running-in-different-environments) +- support of [named caches](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#named-caches) +- [works with Guice](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/40-migration.md#runtime-time-dependency-injection) as well as [compile-time DI](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/40-migration.md#compile-time-dependency-injection) +- [getOrElse and getOrFuture operations](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-cacheapi) easing the use +- [wildcards in remove operation](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-cacheapi) +- support of collections: [sets](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-sets), [lists](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-lists), and [maps](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-maps) +- [increment and decrement operations](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md#use-of-cacheapi) +- [eager and lazy invocation policies](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#eager-and-lazy-invocation) waiting or not waiting for the result +- several [recovery policies](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#recovery-policy) and possibility of further customization +- support of [several configuration sources](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#running-in-different-environments) - static in the configuration file - from the connection string optionally in the environmental variable - custom implementation of the configuration provider -- support of [standalone, cluster,](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#standalone-vs-cluster) - [aws-cluster,](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#aws-cluster) - and [sentinel modes](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#sentinel) -- build on the top of Pekko actors and serializers, [agnostic to the serialization mechanism](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#limitation-of-data-serialization) +- support of [standalone, cluster,](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#standalone-vs-cluster) + [aws-cluster,](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#aws-cluster) + and [sentinel modes](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#sentinel) +- build on the top of Pekko actors and serializers, [agnostic to the serialization mechanism](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#limitation-of-data-serialization) - for simplicity, it uses deprecated Java serialization by default - it is recommended to use [Kryo library](https://github.com/romix/akka-kryo-serialization) or any other mechanism @@ -92,11 +92,11 @@ or you can use shortcuts in the table below. To use this module: -1. [Add this library into your project](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/10-integration.md) and expose APIs -1. See the [configuration options](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md) -1. [Browse examples of use](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/30-how-to-use.md) +1. [Add this library into your project](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/10-integration.md) and expose APIs +1. See the [configuration options](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md) +1. [Browse examples of use](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/30-how-to-use.md) -If you come from older version, you might check the [Migration Guide](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/40-migration.md) +If you come from older version, you might check the [Migration Guide](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/40-migration.md) ## Samples @@ -124,7 +124,7 @@ To your SBT `build.sbt` add the following lines: // enable Play cache API (based on your Play version) libraryDependencies += play.sbt.PlayImport.cacheApi // include play-redis library -libraryDependencies += "com.github.karelcemus" %% "play-redis" % "4.0.0" +libraryDependencies += "com.github.karelcemus" %% "play-redis" % "5.0.0" ``` @@ -132,7 +132,7 @@ libraryDependencies += "com.github.karelcemus" %% "play-redis" % "4.0.0" | play framework | play-redis | documentation | |----------------|------------------------------------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| 3.0.x | 4.0.0 | [see here](https://github.com/KarelCemus/play-redis/blob/4.0.0/README.md) | +| 3.0.x | 5.0.0 | [see here](https://github.com/KarelCemus/play-redis/blob/5.0.0/README.md) | | 2.9.x | 3.0.0 | [see here](https://github.com/KarelCemus/play-redis/blob/3.0.0/README.md) | | 2.8.x | 2.7.0 | [see here](https://github.com/KarelCemus/play-redis/blob/2.7.0/README.md) | | 2.7.x | 2.5.1 | [see here](https://github.com/KarelCemus/play-redis/blob/2.5.1/README.md) | @@ -151,7 +151,7 @@ like this library, please feel free to report it or contact me. ## Changelog For the list of changes and migration guide please see -[the Changelog](https://github.com/KarelCemus/play-redis/blob/4.0.0/CHANGELOG.md). +[the Changelog](https://github.com/KarelCemus/play-redis/blob/5.0.0/CHANGELOG.md). ## Caveat diff --git a/build.sbt b/build.sbt index 888a280..18c671f 100644 --- a/build.sbt +++ b/build.sbt @@ -45,7 +45,7 @@ scalacOptions ++= { ThisBuild / version := "4.0.2" -//enablePlugins(CustomReleasePlugin) +enablePlugins(CustomReleasePlugin) // exclude from tests coverage coverageExcludedFiles := ".*exceptions.*" diff --git a/doc/10-integration.md b/doc/10-integration.md index 8e33f85..c4054bf 100644 --- a/doc/10-integration.md +++ b/doc/10-integration.md @@ -9,7 +9,7 @@ Although the use of runtime-time injection is preferred, both options are equal // enable Play cache API (based on your Play version) libraryDependencies += play.sbt.PlayImport.cacheApi // include play-redis library -libraryDependencies += "com.github.karelcemus" %% "play-redis" % "4.0.0" +libraryDependencies += "com.github.karelcemus" %% "play-redis" % "5.0.0" ``` diff --git a/doc/20-configuration.md b/doc/20-configuration.md index b3ebfeb..156f5a6 100644 --- a/doc/20-configuration.md +++ b/doc/20-configuration.md @@ -1,6 +1,6 @@ # Configuration -Default configuration and very detailed manual is available in [reference.conf](https://github.com/KarelCemus/play-redis/blob/4.0.0/src/main/resources/reference.conf). It can be overwritten in your `conf/application.conf` file. +Default configuration and very detailed manual is available in [reference.conf](https://github.com/KarelCemus/play-redis/blob/5.0.0/src/main/resources/reference.conf). It can be overwritten in your `conf/application.conf` file. There are several features supported in the configuration, they are discussed below. However, by default, there is no need for any further configuration. Default settings are set to the standalone instance running on `localhost:6379?db=0`, which is default for redis server. This instance is named `play` but is also exposed as a default implementation. @@ -147,7 +147,7 @@ play.cache.redis { ## Named caches -Play framework supports [named caches](https://www.playframework.com/documentation/2.6.x/ScalaCache#Accessing-different-caches) through a qualifier. For a simplicity, the default cache is also exposed without a qualifier to ease the access. This feature can be disabled by `bind-default` property, which defaults to true. The name of the default cache is defined in `default-cache` property, which defaults to `play` to keep consistency with Play framework. +Play framework supports [named caches](https://www.playframework.com/documentation/3.0.x/ScalaCache#Accessing-different-caches) through a qualifier. For a simplicity, the default cache is also exposed without a qualifier to ease the access. This feature can be disabled by `bind-default` property, which defaults to true. The name of the default cache is defined in `default-cache` property, which defaults to `play` to keep consistency with Play framework. The configuration of each instance is inherited from the `play.cache.redis` configuration. Inherited values may be locally overridden by the instance's own configuration (e.g., `play.cache.redis.instances.myNamedCache`) @@ -227,13 +227,6 @@ usually does not apply. However, it is expected the cache should be fast respond and thus **by default the timeout is set to 500 millis** to avoid unnecessary delays. This timeout is optional and can be disabled. -### Other timeouts - -Other timeouts you might be interested in are related to the communication to Redis, e.g., connection timeout -and receive timeout. These are provided directly by the underlying connector and `play-redis` doesn't affect them. -For more details, see -the [`Redis` configuration](https://github.com/etaty/rediscala). - ## Recovery policy The intention of cache is usually to optimize the application behavior, not to provide any business logic. diff --git a/doc/40-migration.md b/doc/40-migration.md index 31f32e6..c33aa7b 100644 --- a/doc/40-migration.md +++ b/doc/40-migration.md @@ -25,7 +25,7 @@ changes in public API, which needs your code to be updated. The invocation policy in `2.0.x` was used as an implicit parameter. Since `2.1.x` it is a static configurable property inside the instance configuration. -See the [updated documentation for more details](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#eager-and-lazy-invocation). +See the [updated documentation for more details](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#eager-and-lazy-invocation). ### Named caches uses @NamedCache instead of @Named @@ -39,7 +39,7 @@ Since `2.1.0`, there is a new `redis-timeout` property. To avoid ambiguity, the original `timeout` property was renamed to `sync-redis`. The `timeout` property was deprecated any will be removed in `2.2.0`. -See the updated [documentation for more details](https://github.com/KarelCemus/play-redis/blob/4.0.0/doc/20-configuration.md#eager-and-lazy-invocation). +See the updated [documentation for more details](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#eager-and-lazy-invocation). ## Migration from 1.6.x to 2.0.x @@ -50,8 +50,8 @@ The major goal of the 2.0.x version was to support named caches and clean up the - default database was changed from 1 to 0 (redis default) to remove the inconsistency between play-redis and the redis itself - the cache instance defined directly under the `play.cache.redis` is a default instance and is named with a default name -- introduced `instances` property to support named caches. See [documentation](https://github.com/KarelCemus/play-redis/blob/2.0.2/doc/20-configuration.md#named-caches) for more details. -- `configuration` property was redesigned and renamed to `source`. Valid values are now `standalone`, `cluster`, `connection-string`, and `custom`. See [documentation](https://github.com/KarelCemus/play-redis/blob/2.0.2/doc/20-configuration.md#standalone-vs-cluster) for more details. +- introduced `instances` property to support named caches. See [documentation](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#named-caches) for more details. +- `configuration` property was redesigned and renamed to `source`. Valid values are now `standalone`, `cluster`, `connection-string`, and `custom`. See [documentation](https://github.com/KarelCemus/play-redis/blob/5.0.0/doc/20-configuration.md#standalone-vs-cluster) for more details. - `connection-string-variable` was replaced by the `connection-string` property defining the connection string itself. The value is now passed directly into the property through, e.g., `${REDIS_URL}`, which HOCON correctly resolves. This applies when combined with `source: connection-string`. - `wait` property renamed to `timeout` - `source`, `timeout`, `dispatcher`, and `recovery` define defaults and may be locally overridden within each named cache configuration. @@ -72,7 +72,7 @@ Major redesign of `RedisCacheModule`, however, no changes in use are expected. I #### Compile-time DI -Major redesign of `RedisCacheComponents`. See the [trait](https://github.com/KarelCemus/play-redis/blob/2.0.0/src/main/scala/play/api/cache/redis/RedisCacheComponents.scala#L14) for details. To create +Major redesign of `RedisCacheComponents`. See the [trait](https://github.com/KarelCemus/play-redis/blob/5.0.0/src/main/scala/play/api/cache/redis/RedisCacheComponents.scala#L14) for details. To create new API, call `cacheApi( instance )`, where the instance is either a String with the instance name or `RedisInstance` object with a custom configuration. This returns a `RedisCaches` object encapsulating all available APIs. In case of using multiple different APIs, it is suggested to **reuse this object** to prevent the duplicate creation of instances of the same cache connector. To provide a custom instance configuration, either override `redisInstanceResolver` mapping names to the objects or pass the `RedisInstance` object directly to the `cacheApi` call. For custom recovery policy override `recoveryPolicyResolver`. ### Implementation changes diff --git a/project/CustomReleasePlugin.scala b/project/CustomReleasePlugin.scala index d0d3d7f..110a3c3 100644 --- a/project/CustomReleasePlugin.scala +++ b/project/CustomReleasePlugin.scala @@ -60,7 +60,7 @@ object CustomReleasePlugin extends AutoPlugin { val nextVersion = st.extracted.runTask(releaseVersion, st)._2(currentV) val bump = Version.Bump.Minor - val suggestedReleaseV: String = Version(nextVersion).map(_.bump(bump).unapply).getOrElse(versionFormatError(currentV)) + val suggestedReleaseV: String = Version(nextVersion).map(_.bump(bump).string).getOrElse(versionFormatError(currentV)) st.log.info("Press enter to use the default value") diff --git a/project/plugins.sbt b/project/plugins.sbt index 02adc71..8586550 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,7 +11,7 @@ addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11") addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") +addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") // linters addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")