GithubHelp home page GithubHelp logo

play2-memcached's Introduction

Memcached Plugin for Play framework 2.x

A Memcached implementation of Cache API for Play 2.x. Using spymemcached internally, which is the same as Play 1.x's default Cache implementation.

Usage

Add the following dependency to your Play project:

Library dependencies

For Play 2.6.x and newer: !!! Changed play.modules.cache.* config keys to play.cache.* !!!

  val appDependencies = Seq(
    play.PlayImport.cacheApi,
    "com.github.mumoshu" %% "play2-memcached-play26" % "0.9.2"
  )
  val main = Project(appName).enablePlugins(play.PlayScala).settings(
    version := appVersion,
    libraryDependencies ++= appDependencies,
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.5.x:

  val appDependencies = Seq(
    play.PlayImport.cache,
    "com.github.mumoshu" %% "play2-memcached-play25" % "0.8.0"
  )
  val main = Project(appName).enablePlugins(play.PlayScala).settings(
    version := appVersion,
    libraryDependencies ++= appDependencies,
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.4.x:

  val appDependencies = Seq(
    play.PlayImport.cache,
    "com.github.mumoshu" %% "play2-memcached-play24" % "0.7.0"
  )
  val main = Project(appName).enablePlugins(play.PlayScala).settings(
    version := appVersion,
    libraryDependencies ++= appDependencies,
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.3.x:

  val appDependencies = Seq(
    play.PlayImport.cache,
    "com.github.mumoshu" %% "play2-memcached-play23" % "0.7.0"
  )
  val main = Project(appName).enablePlugins(play.PlayScala).settings(
    version := appVersion,
    libraryDependencies ++= appDependencies,
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.2.0:

  val appDependencies = Seq(
    cache, // or play.Project.cache if not imported play.Project._
    "com.github.mumoshu" %% "play2-memcached" % "0.4.0" // or 0.5.0-RC1 to try the latest improvements
  )
  val main = play.Project(appName, appVersion, appDependencies).settings(
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.1.0:

  val appDependencies = Seq(
    "com.github.mumoshu" %% "play2-memcached" % "0.3.0.3"
  )
  val main = play.Project(appName, appVersion, appDependencies).settings(
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

For Play 2.0:

  val appDependencies = Seq(
    "com.github.mumoshu" %% "play2-memcached" % "0.2.4.3"
  )
  val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
    resolvers += "Spy Repository" at "http://files.couchbase.com/maven2" // required to resolve `spymemcached`, the plugin's dependency.
  )

Configurations

Starting with Play 2.6.x

play.modules.enabled+="com.github.mumoshu.play2.memcached.MemcachedModule"

# Well-known configuration provided by Play
play.cache.defaultCache=default
play.cache.bindCaches=["db-cache", "user-cache", "session-cache"]

# Tell play2-memcached where your memcached host is located at
memcached.host="127.0.0.1:11211"

For Play 2.4.x and above

play.modules.enabled+="com.github.mumoshu.play2.memcached.MemcachedModule"

# To avoid conflict with play2-memcached's Memcached-based cache module
play.modules.disabled+="play.api.cache.EhCacheModule"

# Well-known configuration provided by Play
play.modules.cache.defaultCache=default
play.modules.cache.bindCaches=["db-cache", "user-cache", "session-cache"]

# Tell play2-memcached where your memcached host is located at
memcached.host="127.0.0.1:11211"

Play 2.3.x or below

Add a reference to the plugin in play.plugins file. play.plugins file must be put somewhere in the classpath. My recommendation is to put it in conf/ directory.

  5000:com.github.mumoshu.play2.memcached.MemcachedPlugin

First of all, in application.conf, disable the EhCachePlugin - Play's default implementation of CacheAPI:

  ehcacheplugin=disabled

Specify the host name or IP address of the memcached server, and the port number:

  memcached.host="127.0.0.1:11211"

If you have multiple memcached instances over different host names or IP addresses, provide them like:

  memcached.1.host="mumocached1:11211"
  memcached.2.host="mumocached2:11211"

Code examples

For Play 2.4.x and above

See the Play Framework documentation for the Scala and Java API.

For Play 2.3.x or below

Then, you can use the play.api.cache.Cache object to store a value in memcached:

 Cache.set("key", "theValue")

This way, memcached tries to retain the stored value eternally. Of course Memcached does not guarantee eternity of the value, nor can it retain the value on restart.

If you want the value expired after some time:

 Cache.set("key", "theValueWithExpirationTime", 3600)
 // The value expires after 3600 seconds.

To get the value for a key:

 val theValue = Cache.getAs[String]("key")

You can remove the value (It's not yet a part of Play 2.0's Cache API, though):

 play.api.Play.current.plugin[MemcachedPlugin].get.api.remove("keyToRemove")

Advanced configurations

Disabling the plugin (For Play 2.3.x or below)

You can disable the plugin in a similar manner to Play's build-in Ehcache Plugin. To disable the plugin in application.conf:

  memcachedplugin=disabled

Authentication with SASL

If you memcached requires the client an authentication with SASL, provide username/password like:

  memcached.user=misaka
  memcached.password=mikoto

Configure logging

By default, the plugin (or the spymemcached under the hood) does not output any logs at all. If you need to peek into what's going on, set the log level like:

For Play 2.4.x and above

In your logback.xml:

  <logger name="memcached" level="DEBUG" />

For Play 2.3.x or below

  logger.memcached=DEBUG

Namespacing

You can prefix every key to put/get/remove with a global namespace.

For Play 2.4.x and above

You can inject an (ASync)CacheApi with @play.cache.NamedCache to prefix all the keys you get, set and remove with the given namespace. There is more documentation in the official Play Framework documentation.

  @Inject @play.cache.NamedCache("user-cache") private AsyncCacheApi cacheApi;
For Play 2.3.x or below

By default, the namespace is an empty string, implying you don't use namespacing at all. To enable namespacing, configure it in "application.conf":

  memcached.namespace=mikoto.

Key hashing

Requires play2-memcached 0.9.0 or later

You may consider activating this option to enable support for long keys which are composed of more than 250 characters.

It is disabled by default like:

  memcached.hashkeys=off

You can activate it by specifying the name of a message digest algorithm used for hashing:

  memcached.hashkeys=SHA-1

Available options are MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512. Please refer to http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#MessageDigest for the complete list of available algorithms.

Configuring timeouts

Until Play version 2.6 you can specify timeouts for obtaining values from Memcached. This option isn't needed anymore since Play 2.6 because since that version Play's cache api is async per default.

  # Timeout in 1 second (only until Play version 2.6)
  memcached.timeout=1

Using ElastiCache's Auto-Discovery feature

At first, download the latest AmazonElastiCacheClusterClient-*.jar from the AWS console, or build it yourself as described in The Amazon ElastiCache Cluster Client page in GitHub, and put it under /lib.

Remove the SBT dependency on spymemcached by excluding it from play2-mamcached's transitive dependencies:

  "com.github.mumoshu" %% "play2-memcached" % "0.5.0-RC1 exclude("net.spy", "spymemcached")

Configure your configuration endpoint in application.conf:

  elasticache.config.endpoint="mycachename.asdfjk.cfg.use1.cache.amazonaws.com:11211".

Version history

0.2.2 Fixed the logging leak issue. You don't get a bunch of INFO messages to play app's default logger anymore.

0.2.3 Allow removing keys in both Java and Scala ways described in Play's documentation. See MemcachedIntegrationSpec.scala for how to remove keys in Scala.

0.2.4 Introduced "namespace" to prefix every key to put/get/remove with a global namespace configured in "application.conf"

0.2.4.1 Updated spymemcached to 2.8.12

0.2.4.3 Updated spymemcached to 2.9.0 which solves the authentication issues.

0.3.0 Built for Play 2.1.0 and available in the Maven Central. Also updated spymemcached to 2.8.4.

0.3.0.1 Updated spymemcached to 2.8.12

0.3.0.2 Reverted spymemcached to 2.8.9 to deal with authentication failures to various memcache servers caused by spymemcached 2.8.10+. See #17 and #20 for details.

0.3.0.3 Updated spymemcached to 2.9.0 which solves the authentication issues.

0.4.0 Build for Play 2.2.0

0.5.0-RC1 Improvements: #14 Adding support for Amazon Elasticache (thanks to @kamatsuoka) #23 Adding configurable timeouts on the future (thanks to @rmmeans) #24 Empty keys - kind of ehcache compilance, avoiding IllegalArgumentExceptions (thanks to @mkubala)

0.7.0 Cross built for Play 2.3.x, 2.4.x, Scala 2.10.5 and 2.11.6. Artifact IDs are renamed to play2-memcached-play2{3,4}_2.1{0,1}

0.8.0 Built for Play 2.5.x and Scala 2.11.11. Artifact ID for this build is play2-memcached-play25_2.11

0.9.0 Built for Play 2.6.x and Scala 2.11.11 and 2.12.3. Artifact ID for this build is play2-memcached-play26_2.1{1,2} !!! Changed play.modules.cache.* config keys to play.cache.* !!!

0.9.1 Remove global state by removing reference to deprecated Play.current

0.9.2 Fix frozen future in 2.6 API

0.10.0-M1 Built for Play 2.7.0-M1 and Scala 2.11.12 and 2.12.6. Artifact ID for this build is play2-memcached-play27_2.1{1,2}

0.10.0-M2 Built for Play 2.7.0-M2 and Scala 2.11.12 and 2.12.6. Artifact ID for this build is play2-memcached-play27_2.1{1,2}

0.10.0-RC3 Built for Play 2.7.0-RC8 and Scala 2.11.12 and 2.12.7. Artifact ID for this build is play2-memcached-play27_2.1{1,2}

0.10.0 Built for Play 2.7.0 and Scala 2.11.12 and 2.12.8. Artifact ID for this build is play2-memcached-play27_2.1{1,2}

0.10.1 Built for Play 2.7.3 and Scala 2.13.0, 2.11.12 and 2.12.8. Artifact ID for this build is play2-memcached-play27_2.1{1,2,3}

0.11.0 Built for Play 2.8.0 and Scala 2.13.1 and 2.12.10. Artifact ID for this build is play2-memcached-play28_2.1{2,3}

0.12.0 Built for Play 2.9.0 and Scala 2.13.12 and 3.3.1. Artifact ID for this build is play2-memcached-play29_[2.13|3]

Publishing to the central

# Play 2.5
PLAY_VERSION=2.5.0 sbt ++2.11.12 publishSigned sonatypeRelease

# Play 2.6
PLAY_VERSION=2.6.0 sbt ++2.12.8 publishSigned sonatypeRelease

# Play 2.7
PLAY_VERSION=2.7.3 sbt ++2.11.12 publishSigned sonatypeRelease
PLAY_VERSION=2.7.3 sbt ++2.12.8 publishSigned sonatypeRelease
PLAY_VERSION=2.7.3 sbt ++2.13.0 publishSigned sonatypeRelease

# Play 2.8
PLAY_VERSION=2.8.0 sbt ++2.12.10 publishSigned sonatypeRelease
PLAY_VERSION=2.8.0 sbt ++2.13.1 publishSigned sonatypeRelease

# Play 2.9
PLAY_VERSION=2.9.0 sbt ++2.13.12 publishSigned sonatypeRelease
PLAY_VERSION=2.9.0 sbt ++3.3.1 publishSigned sonatypeRelease

Acknowledgement

Thanks to: @gakuzzzz for the original idea of "namespacing" and the initial pull request for it. @kamatsuoka for adding support for Amazon Elasticache. @rmmeans for adding configurable timeouts on the future. @mkubala for improving compliance with EhCache.

Build status

Build Status

play2-memcached's People

Contributors

duknic avatar enalmada avatar halfninja avatar hayd avatar jtjeferreira avatar kamatsuoka avatar mkurz avatar mumoshu avatar nsiemens avatar rmmeans avatar royalan avatar s-a-y avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play2-memcached's Issues

MemcachedCacheApi returns an error for a success memcached result

We are using Play 2.6.18 with "com.github.mumoshu" %% "play2-memcached-play26" % "0.9.3"

And quite often logs contains rows like:
m.plugin - An error has occured while getting the value from memcached. ct=someClass. key=somekey spymemcached code: SUCCESS memcached code:OK
, where memcached seems returned normal response, but plugin returned failed result.

Please suggest what could be a reason of such behavior.

Failed depenendency when try to build project locally

I did sbt compile and got:

[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: com.typesafe.play#play-test_2.10;2.7.0-M2: not found
[warn] 	:: com.typesafe.play#play_2.10;2.7.0-M2: not found
[warn] 	:: com.typesafe.play#play-cache_2.10;2.7.0-M2: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::

Current builds not compatible with play 2.7 milestone 1

Play framework released their first milestone for play 2.7, 2.7-M1.

I tried upgrading a project that uses memcached, but it failed to run.

This is the output I got:

! @78dd9o295 - Internal server error, for (GET) [/] ->

play.api.UnexpectedException: Unexpected exception[NoClassDefFoundError: play/api/cache/CacheApi]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:189)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:84)
at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:177)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:647)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: play/api/cache/CacheApi
at com.github.mumoshu.play2.memcached.MemcachedModule$$anonfun$$lessinit$greater$1.apply(MemcachedModule.scala:61)
at com.github.mumoshu.play2.memcached.MemcachedModule$$anonfun$$lessinit$greater$1.apply(MemcachedModule.scala:20)
at play.api.inject.SimpleModule.bindings(Module.scala:88)
at play.api.inject.guice.GuiceableModuleConversions.guice(GuiceInjectorBuilder.scala:340)
at play.api.inject.guice.GuiceableModuleConversions.guice$(GuiceInjectorBuilder.scala:339)
at play.api.inject.guice.GuiceableModule$.guice(GuiceInjectorBuilder.scala:274)
at play.api.inject.guice.GuiceableModuleConversions$$anon$3.$anonfun$guiced$2(GuiceInjectorBuilder.scala:319)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.collection.TraversableLike.map(TraversableLike.scala:234)
at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
at scala.collection.immutable.List.map(List.scala:295)
at play.api.inject.guice.GuiceableModuleConversions$$anon$3.guiced(GuiceInjectorBuilder.scala:319)
at play.api.inject.guice.GuiceableModule$.$anonfun$guiced$1(GuiceInjectorBuilder.scala:296)
at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)
at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)
at scala.collection.immutable.List.flatMap(List.scala:352)
at play.api.inject.guice.GuiceableModule$.guiced(GuiceInjectorBuilder.scala:296)
at play.api.inject.guice.GuiceBuilder.createModule(GuiceInjectorBuilder.scala:171)
at play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:111)
at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:186)
at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:139)
at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
at play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:173)
at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:165)
… 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: play.api.cache.CacheApi
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 63 common frames omitted
Stopping Play…

When asked on play framework's forum, it was stated that the version of the dependency wasn't compatible: https://discuss.lightbend.com/t/play-2-7-0-m1-released/1380/10

Is the time right now for compiling a version for milestone 1 so it can be tested, or is it better to wait for the full release?

Multiple memcached instances : data stored only in one instance

Hello,

I have specified two memcached instances in file environnement.conf

memcached.1.host="localhost:11212"
memcached.2.host="localhost:11211"

Via telnet I added an entry for key "toto" in memcached server with port 11211, no entry was founded in my application,
if I add an entry for key "toto" in memcached server with port 11212, one entry is founded in my application.

I think the cache return value's key of one server, 11211 or 11212, if found from them in one.
This is the normal behavior or this is a bug ?

Connection Failures thrown when using clustered memcached server

Hello,

We have setup a memcached cluster, eg: a Load Balancer with two memcached instances. When we configure application.conf / memached.host to point to the Load Balancer, we are getting connection errors. The errors occur at the moment when we try to do a cache.get. Here is the sample code:

application.conf =
ehcacheplugin=disabled
memcached.host="elb-url:11211"

NOTES

  1. Note that this is the url indicated for the 2nd error.
    load-memcached-elb-1610895556.us-east-1.elb.amazonaws.com/52.4.194.128:11211
  2. That one of the errors indicates there were problems trying to reconnect. Is this possibly caused because the ELB does not guarantee going back to the same node ? How to fix this ?
    a) use a different type of load balancer (other than ELB)
    b) do not configure memcached.host to memcached ELB,

Exception 1:
java.util.concurrent.ExecutionException: java.util.concurrent.CancellationException: Cancelled
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:170) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:112) ~[com.github.mumoshu.play2-memcached_2.10-0.6.0.jar:0.6.0]
at play.api.cache.Cache$.get(Cache.scala:80) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at play.api.cache.Cache.get(Cache.scala) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at play.cache.Cache.get(Cache.java:19) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at com.healthfleet.util.CacheUtil.cacheGet(CacheUtil.java:71) [prometheus.prometheus-1.3128-SNAPSHOT.jar:1.3128-SNAPSHOT]
........

Exception 2:
net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: load-memcached-elb-1610895556.us-east-1.elb.amazonaws.com/52.4.194.128:11211
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:160) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:112) ~[com.github.mumoshu.play2-memcached_2.10-0.6.0.jar:0.6.0]
at play.api.cache.Cache$.get(Cache.scala:80) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at play.api.cache.Cache.get(Cache.scala) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at play.cache.Cache.get(Cache.java:19) [com.typesafe.play.play-cache_2.10-2.3.8.jar:2.3.8]
at com.healthfleet.util.CacheUtil.cacheGet(CacheUtil.java:71) [prometheus.prometheus-1.3128-SNAPSHOT.jar:1.3128-SNAPSHOT]
.......

distributed cache between multiples server

HI,

i read on some website to use this great tool to use distributed cache on multiple servers.

but i don't read in your documentation how to use and configure it (i use playframework 2.5.15)

thank you !

Artifact for Play 2.0

Hello,

can you publish version 2.3 and 2.4 for play 2.0 on sonatype please

thanks

Use of java for serialization does not directly replace ehcache

You are using Java to do the object serialization. This turns into a gotcha because the default play2 cache doesn't, and therefore is able to serialize classes that don't implement Serializable. Which causes fireworks when your plugin replaces the default and everything that caches a non-implementer of Serializable breaks because of the additional requirement that your plugin is placing on input to the Cache.

Set() and remove() methods behaves unreliably on play 2.5 and older because of race conditions

I noticed that the set() and remove() implementation of CacheAPI call async methods on spy.memcached.MemcachedClient which return futures but the futures are ignored. The default cache in play (prior to version 2.6) is synchronous and any replacement of the default implementation should conform to the same interface.

I ran into this problem when a value that was just saved with set() wasn't found with the following get() call. Because the CacheAPI interface uses Unit as the return type for set() and remove() the implementation of play2-memcached should await the futures returned by spy.memcached.MemcachedClient. The async methods could still be provided by explicitly calling the plugin with for example:

play.api.Play.current.plugin[MemcachedPlugin].get.asyncSet(...)

I can create a pull request for this but I'm not sure on which branch/commit should I base it on and to which branch should I target the PR such that this fix can be introduced to the versions meant for older play versions?

A few lines are using wrong logger

If I am not mistaken, these two lines should be using the "logger" and not the "Logger". My logs are filling up with these messages despite memcached level being WARN.

 Logger.info("Getting the cached for key " + key)
 Logger.info("any is " + any.getClass)

Question : Error when running memcache

Hi Team,

Firstly I want to thank you about your amazing work, I am working on implementing memcache with my project [play 2.2.3 and scala 2.10.3], when I did your notes, I get this error, can you please help me ?

! @6kaia0k7k - Internal server error, for (GET) [/categories?countryCode=jo] ->

play.api.UnexpectedException: Unexpected exception[NotSerializableException: models.Setting]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:148) ~[play_2.10-2.2.3.jar:2.2.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.3.jar:2.2.3]
at scala.Option.map(Option.scala:145) ~[scala-library-2.10.3.jar:na]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:112) ~[play_2.10-2.2.3.jar:2.2.3]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:110) ~[play_2.10-2.2.3.jar:2.2.3]
at scala.util.Success.flatMap(Try.scala:200) ~[scala-library-2.10.3.jar:na]
Caused by: java.io.NotSerializableException: models.Setting
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) ~[na:1.8.0_25]
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) ~[na:1.8.0_25]
at com.github.mumoshu.play2.memcached.MemcachedPlugin$CustomSerializing.serialize(MemcachedPlugin.scala:93) ~[play2-memcached_2.10-0.4.0.jar:0.4.0]
at net.spy.memcached.transcoders.SerializingTranscoder.encode(SerializingTranscoder.java:162) ~[spymemcached-2.9.0.jar:2.9.0]
at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:291) ~[spymemcached-2.9.0.jar:2.9.0]
at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:807) ~[spymemcached-2.9.0.jar:2.9.0]

An error has occured while getting the value from memcached

[error] m.plugin - An error has occured while getting the value from memcached
net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node: /127.0.0.1:11211
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:160) ~[spymemcached-2.9.0.jar:2.9.0]
at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62) ~[spymemcached-2.9.0.jar:2.9.0]
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:106) ~[play2-memcached_2.10-0.4.0.jar:0.4.0]
at play.api.cache.Cache$.get(Cache.scala:77) [play-cache_2.10.jar:2.2.0]
at play.api.cache.Cache.get(Cache.scala) [play-cache_2.10.jar:2.2.0]
at play.cache.Cache.get(Cache.java:16) [play-cache_2.10.jar:2.2.0]

Play for Java 2.4 and ClassNotFoundException

I've updated build.sbt and application conf, but I've got:

java.lang.ClassNotFoundException: com.github.mumoshu.play2.memcached.MemcachedPlugin
     java.net.URLClassLoader.findClass(URLClassLoader.java:381)
     java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     java.lang.Class.forName0(Native Method)
     java.lang.Class.forName(Class.java:348)
     play.utils.Reflect$.getClass(Reflect.scala:142)
     play.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:88)
     play.api.Plugins$$anonfun$loadPlugins$1.apply(Plugins.scala:87)
     scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
     scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
     scala.collection.immutable.List.foreach(List.scala:381)
     scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
     scala.collection.immutable.List.map(List.scala:285)
     play.api.Plugins$.loadPlugins(Plugins.scala:87)
     play.api.Plugins$$anonfun$apply$4.apply(Plugins.scala:100)
     play.api.Plugins$$anonfun$apply$4.apply(Plugins.scala:100)
     play.api.Plugins.thePlugins$lzycompute(Plugins.scala:59)
     play.api.Plugins.thePlugins(Plugins.scala:59)
     play.api.Plugins.length(Plugins.scala:60)
     scala.collection.IndexedSeqLike$class.iterator(IndexedSeqLike.scala:90)
     play.api.Plugins.iterator(Plugins.scala:57)
     scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
     play.api.Plugins.foreach(Plugins.scala:57)
     play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
     play.api.Play$$anonfun$start$1.apply(Play.scala:91)
     play.api.Play$$anonfun$start$1.apply(Play.scala:91)
     play.utils.Threads$.withContextClassLoader(Threads.scala:21)
     play.api.Play$.start(Play.scala:90)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:156)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:121)
     scala.Option.map(Option.scala:146)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:121)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:119)
     scala.util.Success.flatMap(Try.scala:230)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:119)
     play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111)
     scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
     scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
     java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
     java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
     java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
     java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689)
     java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Support removing key by passing null and 0

The documentation states that the only way to remove a key from cache is to pass in a null with 0
Cache.set("item.key", null, 0);
https://github.com/playframework/Play20/wiki/JavaCache

I see that serialize throws null if null is passed in, but I think perhaps passing null and 0 should be a special case and internally call delete. I am thking something like this?

def set(key: String, value: Any, expiration: Int) {
if(value == null && expiration == 0) {
client.remove(key)
} else {
client.set(key, expiration, value, tc)
}
}

Update Spy to 2.8.12

Hi,

spy is currently at 2.8.12, there have been some bugfixes around ketama hashing as well - do you mind updating the dependency? Should be straightforward from the plugins perspective!

hashkeys missing from play-2.2 branch

Hello,

I would like to use play2-memcached with play 2.2.x. I noticed that the hashkeys merge is not yet in 2.2.x and I guess master does not support play 2.2.

I'm wondering if there are any blocking issues for merging that support (586be98) into the play-2.2 branch.

I'm looking to use securesocial plugin with play, and it uses keys > 250 character

Thanks!

Exception during starting memcached in Play2.3.7

Hi,

Firstly, thanks for such a great plugin and the good work you are doing.
I am trying to use memcached in my project (play2.3.7, java8) and using this plugin version 0.7.0 (play2-memcached-play23_2.11-0.7.0) along with spymemcached-2.9.1 but I get the following exception and application fails to start. I need to get this up and going as my project is going live shortly.

play.api.Application$$anon$1: Execution exception[[NullPointerException: null]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:145) [scala-library-2.11.1.jar:na]
Caused by: java.lang.NullPointerException: null
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:106) ~[play2-memcached-play23_2.11-0.7.0.jar:0.7.0]
at play.api.cache.Cache$.get(Cache.scala:80) ~[play-cache_2.11-2.3.7.jar:2.3.7]
at play.api.cache.Cache.get(Cache.scala) ~[play-cache_2.11-2.3.7.jar:2.3.7]
at play.cache.Cache.get(Cache.java:19) ~[play-cache_2.11-2.3.7.jar:2.3.7]

Looking forward for your help in resolving this issue.

Regards,
Irshad

Expiration is buggy for periods over 30 days

Memcached interprets expirations over 30 days (so over 2592000 seconds) as UNIX timestamps (see https://code.google.com/p/memcached/wiki/NewProgramming#Expiration). That case is not handled in code, so when passing the 30 days threshold keys are immediately expired as the resulting "timestamp" is in the past.

I wanted to handle that by setting https://github.com/mumoshu/play2-memcached/blob/master/plugin/src/main/scala/com/github/mumoshu/play2/memcached/MemcachedPlugin.scala#L136 to System.currentTimeMillis() + expiration but it looks like memcached client is only handling ints so that would be extremely risky. Ideas?

Error accessing the cache after deploying to Heroku

Hey guys!

Just informing that I am deploying with heroku and its the first time I have remote debugging configured (not sure if this can relate to the issue or not).

I am simply trying to set and read from the cache but the following errors occur.

[warn] memcached - Closing, and reopening {blablabla}, attempt 0.
[warn] memcached - Discarding partially completed op: Cmd: get Keys: play1406683782792716_1319587618164706Exp: 0
[error] m.plugin - An error has occured while getting the value from memcached. ct=Any. key=1406683782792716_1319587618164706. spymemcached code: CANCELLED memcached code:cancelled
[warn] memcached - Could not redistribute to another node, retrying primary node for play1406683782792716_1319587618164706.

(after this it retries twice and produces the same outcome)

I've tried a few things but no success including switching from memcachedcloud to memcachier.

What is strange is that the cache configuration is running ok on a different heroku app.

Please help me get to the bottom of this.

Thanks

Exception with Play 2.1

I've upgraded to 0.3.0 (when migrating to Play 2.1 / Scala 2.10), and I get the following exception when trying to get a value from cache:

[error] m.plugin - An error has occured while getting the value from memcached
java.util.concurrent.ExecutionException: java.io.EOFException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) ~[na:1.7.0_07]
at java.util.concurrent.FutureTask.get(FutureTask.java:111) ~[na:1.7.0_07]
at net.spy.memcached.transcoders.TranscodeService$Task.get(TranscodeService.java:97) ~[spymemcached-2.8.4.jar:2.8.4]
at net.spy.memcached.internal.GetFuture.get(GetFuture.java:63) ~[spymemcached-2.8.4.jar:2.8.4]
at com.github.mumoshu.play2.memcached.MemcachedPlugin$$anon$2.get(MemcachedPlugin.scala:103) ~[play2-memcached_2.10-0.3.0.jar:0.3.0]
at play.api.cache.Cache$.get(Cache.scala:65) [play_2.10.jar:2.1.0]
java.io.EOFException: null
at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340) ~[na:1.7.0_07]
at java.io.ObjectInputStream$BlockDataInputStream.readUnsignedShort(ObjectInputStream.java:2781) ~[na:1.7.0_07]
at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2837) ~[na:1.7.0_07]
at java.io.ObjectInputStream.readUTF(ObjectInputStream.java:1069) ~[na:1.7.0_07]
at models.UserDao.readExternal(UserDao.scala:127) ~[invi-server_2.10-March%2019th,%202013.jar:March 19th, 2013]
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1810) ~[na:1.7.0_07]

The UserDao object implements the Externalizable interface. The exact same code works with the previous version. Any suggestions?

Readme unclear regarding namespacing

The readme shows the following configuration (among others):

play.modules.cache.defaultCache=default

and then goes on to say that the namespace is empty by default and may be set with the following key

memcached.namespace=mikoto.

Looking at the code (and running an application based on this lib) however suggests that the key memcached.namespace is never read and namespace will be taken from the key play.modules.cache.defaultCache which essentially means if people are following this readme, they'll end up with a namespace called default.

I came across this issue since securesocial uses quite large keys and already provides the idLengthInBytes to restrict them, however this namespace lead to another KeyTooLongException during the migration to play 2.4.

Please upgrade to Play 2.5

Should be very easy:

  • sbt version is now 0.13.11
  • Scala 2.10 was dropped, Scala version should be 2.11.7 only.

Exception when using play-authenticate & memcached (play2.4)

Hello,

I used memcached with play-authenticate instead of default Ehcache, and i've got an exception when trying to login with Twitter provider.
Here are the exception log:

2015-08-20T08:03:20.909420+00:00 app[web.2]: [error] m.plugin - An error has occured while getting the value from memcached. ct=Any
2015-08-20T08:03:20.909428+00:00 app[web.2]:    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909426+00:00 app[web.2]: java.util.concurrent.ExecutionException: java.io.InvalidClassException: com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider$SerializableRequestToken; no valid constructor
2015-08-20T08:03:20.909429+00:00 app[web.2]:    at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909432+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$Task.get(TranscodeService.java:97) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909438+00:00 app[web.2]:    at play.cache.DefaultCacheApi.get(DefaultCacheApi.java:25) [com.typesafe.play.play-cache_2.11-2.4.0.jar:2.4.0]
2015-08-20T08:03:20.909434+00:00 app[web.2]:    at net.spy.memcached.internal.GetFuture.get(GetFuture.java:63) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909439+00:00 app[web.2]:    at play.cache.Cache.get(Cache.java:23) [com.typesafe.play.play-cache_2.11-2.4.0.jar:2.4.0]
2015-08-20T08:03:20.909445+00:00 app[web.2]:    at com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider.authenticate(OAuth1AuthProvider.java:119) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909446+00:00 app[web.2]: Caused by: java.io.InvalidClassException: com.feth.play.module.pa.providers.oauth1.OAuth1AuthProvider$SerializableRequestToken; no valid constructor
2015-08-20T08:03:20.909448+00:00 app[web.2]:    at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:150) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909441+00:00 app[web.2]:    at com.feth.play.module.pa.PlayAuthenticate.getFromCache(PlayAuthenticate.java:294) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909454+00:00 app[web.2]:    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909443+00:00 app[web.2]:    at com.feth.play.module.pa.PlayAuthenticate.removeFromCache(PlayAuthenticate.java:280) [com.feth.play-authenticate_2.11-0.7.0-SNAPSHOT.jar:0.7.0-SNAPSHOT]
2015-08-20T08:03:20.909436+00:00 app[web.2]:    at com.github.mumoshu.play2.memcached.MemcachedCacheApi.get(MemcachedCacheApi.scala:42) ~[com.github.mumoshu.play2-memcached-play24_2.11-0.7.0.jar:0.7.0]
2015-08-20T08:03:20.909451+00:00 app[web.2]:    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1775) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909455+00:00 app[web.2]:    at com.github.mumoshu.play2.memcached.CustomSerializing.deserialize(CustomSerializing.scala:16) ~[com.github.mumoshu.play2-memcached-play24_2.11-0.7.0.jar:0.7.0]
2015-08-20T08:03:20.909458+00:00 app[web.2]:    at net.spy.memcached.transcoders.SerializingTranscoder.decode(SerializingTranscoder.java:88) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909449+00:00 app[web.2]:    at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:768) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909452+00:00 app[web.2]:    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909461+00:00 app[web.2]:    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_20-'slim']
2015-08-20T08:03:20.909462+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$Task.run(TranscodeService.java:110) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]
2015-08-20T08:03:20.909459+00:00 app[web.2]:    at net.spy.memcached.transcoders.TranscodeService$1.call(TranscodeService.java:63) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]

Do you have any idea about this issue? Login with other providers are still working fine, just with twitter provider, i got this issue when getting value from Cache.

Thanks.

FYI: spymemcached 2.8.10+ doesn't work with memcachier

spymemcached 2.8.10+ doesn't work with memcachier. A lot of the cloud hosting solutions suggest using memcachier, making this plugin somewhat frustrating since it does not work out of the box for that. I don't know if this is something you should have to fix (dropping to 2.8.9 or using a different memcached library), or simply adding a FYI to the documentation to give people a heads up.

Document Example of Using Elasticache

We are interested in using this plugin to connect to an Amazon Elasticache cluster. I noticed that a pull request for this feature was merged and the issue closed, but I am unsure how to configure a project to make use of this functionality. There doesn't appear to be anything in the documentation yet. Unfortunately I do not know Scala well as we are a Java shop, so going by the source code is a bit difficult.

We are especially interested in the cluster auto-discovery so we don't have to worry about maintaining a list of our cache instances and can auto-scale our cluster without having to redeploy the application.

It would be nice if the documentation would cover:

  • How to configure Build.scala for any required dependencies. Specifically, how to include the Elasticache client jar(s)
  • How to configure application.conf in this scenario. Specifically, it would be good to know how to configure the Elasticache endpoint for node auto-discovery.

Thanks!

Empty key exception

I'm getting an IllegalArgumentException on quering with an empty key. Is it not a better solution to return a None?

Thanks, Artem.

NoSuchFieldError: TRACE when used with elasticache.

When setting the app dependency for play2-memcached with AWS elasticache as described in the readme, I get a NoSuchFieldError: TRACE when running my application. I have the AWS elasticache client jar in my lib folder and I excluded net.spy as described in the documentation ("com.github.mumoshu" %% "play2-memcached" % "0.5.0-RC1 exclude("net.spy", "spymemcached")). Am I missing something? Any assistance would be greatly appreciated. Thanks!

no default for play.modules.cache?

It looks like in play 2.4 the default cache implementation doesn't require these configs, but this module does. It would be nice if this module also had sensible defaults, so these configs wouldn't be necessary if you are just using the default cache.

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

NotSerializableException

Hi, i try to use Memcache to store a ebean model object.
I save the object but i have this exception:
"java.io.NotSerializableException: play.libs.F$Tuple"

Any ideas? Thanks

License?

Hi.

This plugin has spared me the effort of writing my own Memcache plugin for Play 2.0, thanks for sharing it.

I did not see any license anywhere in the project page. Have you considered any license for this work? It would very good to know so that we may (or may not) include your plugin code in commercial Play 2.0 applications.

Thanks.

no retry/reconnect after timeout of memcache request - net.spy.memcached.internal.CheckedOperationTimeoutException

We have a setup of 2 app servers sharing the same memcache, we are seeing this error a lot

ERROR memcached.plugin An error has occured while getting the value from memcached. ct=Any
1431624:net.spy.memcached.internal.CheckedOperationTimeoutException: Timed out waiting for operation - failing node:
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:160) ~[net.spy.spymemcached-2.9.0.jar:2.9.0]

The problem is once you hit this timeout, the memcached plugin never recovers/reconnects, and you always then see those errors all the time ? cant we retry or reconnect if we have a time out ? or is this more supposed to be solved in spy.memcached world ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.