play-modules-redis


License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

jp.co.bizreach
ArtifactId

ArtifactId

play-modules-redis_2.12
Last Version

Last Version

2.7.1
Release Date

Release Date

Type

Type

jar
Description

Description

play-modules-redis
play-modules-redis
Project URL

Project URL

https://github.com/bizreach/play-redis
Project Organization

Project Organization

jp.co.bizreach
Source Code Management

Source Code Management

https://github.com/bizreach/play-redis

Download play-modules-redis_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/jp.co.bizreach/play-modules-redis_2.12/ -->
<dependency>
    <groupId>jp.co.bizreach</groupId>
    <artifactId>play-modules-redis_2.12</artifactId>
    <version>2.7.1</version>
</dependency>
// https://jarcasting.com/artifacts/jp.co.bizreach/play-modules-redis_2.12/
implementation 'jp.co.bizreach:play-modules-redis_2.12:2.7.1'
// https://jarcasting.com/artifacts/jp.co.bizreach/play-modules-redis_2.12/
implementation ("jp.co.bizreach:play-modules-redis_2.12:2.7.1")
'jp.co.bizreach:play-modules-redis_2.12:jar:2.7.1'
<dependency org="jp.co.bizreach" name="play-modules-redis_2.12" rev="2.7.1">
  <artifact name="play-modules-redis_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='jp.co.bizreach', module='play-modules-redis_2.12', version='2.7.1')
)
libraryDependencies += "jp.co.bizreach" % "play-modules-redis_2.12" % "2.7.1"
[jp.co.bizreach/play-modules-redis_2.12 "2.7.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.8
com.typesafe.play : play-cache_2.12 jar 2.7.3
biz.source_code : base64coder jar 2010-12-19
redis.clients : jedis jar 3.0.1

provided (1)

Group / Artifact Type Version
com.typesafe.play : play_2.12 jar 2.7.3

test (2)

Group / Artifact Type Version
com.typesafe.play : play-test_2.12 jar 2.7.3
com.typesafe.play : play-specs2_2.12 jar 2.7.3

Project Modules

There are no modules declared in this project.

Play Redis Plugin Build Status

A fork of the former official (but not maintained now) redis plugin for Play Framework.

This plugin provides support for Redis using the best Java driver Jedis.

Versions

Plugin version Play version
2.7.1 2.7.x
2.6.1 2.6.x
2.5.1 2.5.x

How to install

Add "jp.co.bizreach" %% "play-modules-redis" % "(plugin version)" to your dependencies.

Features

Configurations

  • Point to your Redis server using configuration settings redis.host, redis.port, redis.password and redis.database (defaults: localhost, 6379, null and 0)
  • Alternatively, specify a URI-based configuration using redis.uri (for example: redis.uri="redis://user:password@localhost:6379").
  • Set the timeout in milliseconds using redis.timeout (default is 2000).
  • Configure any aspect of the connection pool. See the documentation for commons-pool2 GenericObjectPoolConfig, the underlying pool implementation, for more information on each setting.
    • redis.pool.maxIdle
    • redis.pool.minIdle
    • redis.pool.maxTotal
    • redis.pool.maxWaitMillis
    • redis.pool.testOnBorrow
    • redis.pool.testOnReturn
    • redis.pool.testWhileIdle
    • redis.pool.timeBetweenEvictionRunsMillis
    • redis.pool.numTestsPerEvictionRun
    • redis.pool.minEvictableIdleTimeMillis
    • redis.pool.softMinEvictableIdleTimeMillis
    • redis.pool.lifo
    • redis.pool.blockWhenExhausted

Allows direct access to Jedis

Because the underlying Jedis Pool was injected for the cache module to use, you can just inject the Jedis Pool yourself, something like this:

//scala
import javax.inject.Inject
import redis.clients.jedis.JedisPool

import play.api.mvc._

class TryIt @Inject()(jedisPool: JedisPool, cc: ControllerComponents) extends AbstractController(cc) {
  ...
}
//java
import javax.inject.Inject;
import redis.clients.jedis.JedisPool;

import play.mvc.*;

public class TryIt extends Controller {

   //The JedisPool will be injected for you from the module
   @Inject JedisPool jedisPool;

   ...
}

This plugin also supports compile time DI via RedisCacheComponents. Mix this in with your custom application loader just like you would if you were using EhCacheComponents from the reference cache module.

Accessing different caches

Play 2.7 2.6

This plugin supports NamedCaches through key namespacing on a single Jedis pool. To add additional namespaces besides the default (play), the configuration would look like such:

play.cache.bindCaches = ["db-cache", "user-cache", "session-cache"]

Play 2.5

The default cache module (EhCache) will be used for all non-named cache UNLESS this module (RedisModule) is the only cache module that was loaded. If this module is the only cache module being loaded, it will work as expected on named and non-named cache. To disable the default cache module so that this Redis Module can be the default cache you must put this in your configuration:

play.modules.disabled = ["play.api.cache.EhCacheModule"]

This plugin supports play 2.5 NamedCaches through key namespacing on a single Jedis pool. To add additional namespaces besides the default (play), the configuration would look like such:

play.cache.redis.bindCaches = ["db-cache", "user-cache", "session-cache"]

Licence

This software is licensed under the Apache 2 license, quoted below.

Copyright 2018 BizReach (http://www.bizreach.co.jp/).
Copyright 2012 Typesafe (http://www.typesafe.com).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

jp.co.bizreach

BizReach,Inc.

Versions

Version
2.7.1
2.7.0
2.6.1
2.6.0