I am running Java Play framework version v2.6.1 and using Ebean for persistence. My intention is to get bean caching going using play2-memcached plugin.
What have I done so far?
memcached
on localhost and enabled verbose logging.ehcache
dependency with cacheApi
in libraryDependencies
in build.sbt
(this, I assume, should remove Ehcache completely)."com.github.mumoshu" %% "play2-memcached-play26" % "0.9.0",
to libraryDependencies
in build.sbt
"Spy Repository" at "http://files.couchbase.com/maven2",
to resolvers
in build.sbt
play.modules.disabled += "play.api.cache.ehcache.EhCacheModule"
play.modules.enabled+="com.github.mumoshu.play2.memcached.MemcachedModule"
play.cache.defaultCache=default
play.cache.bindCaches=["db-cache", "user-cache", "session-cache"]
memcached.host="127.0.0.1:11211"
Serializable
, also added @com.avaje.ebean.annotation.Cache
annotation.What works?
Entity.find.byId(id)
results SQL SELECT
. Loading it again with different request results no SQL statements.com.github.mumoshu
are loaded.What doesn't work?
netstat -na | grep 11211
.Is there anything I'm missing?
You also need to bind javax.caching.CacheManager
.
Add
libraryDependencies += jcache
to your build.sbt
.
If you are using Guice, you have to add the following for Java annotations as well:
libraryDependencies += "org.jsr107.ri" % "cache-annotations-ri-guice" % "1.0.0"
More information can be found in the "JCache Support" section of the Playframework documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With