Getting Java Play framework to cache Ebean entities using memcached : <p>I am running <a href="https://www.playframework.com" rel="noreferrer">Java Play framework</a> version v2.6.1 and using <a href="http://ebean-orm.github.io/" rel="noreferrer">Ebean</a> for persistence. My intention is to get <a href="http://ebean-orm.github.io/docs/features/l2caching/using-bean-cache" rel="noreferrer">bean caching</a> going using <a href="https://github.com/mumoshu/play2-memcached" rel="noreferrer">play2-memcached</a> plugin.</p>

<p><strong>What have I done so far?</strong></p>

<ul>
<li>installed <code>memcached</code> on localhost and enabled verbose logging.</li>
<li>replaced <code>ehcache</code> dependency with <code>cacheApi</code> in <code>libraryDependencies</code> in <code>build.sbt</code> (this, I assume, should remove Ehcache completely).</li>
<li>added <code>"com.github.mumoshu" %% "play2-memcached-play26" % "0.9.0",</code> to <code>libraryDependencies</code> in <code>build.sbt</code></li>
<li>added <code>"Spy Repository" at "http://files.couchbase.com/maven2",</code> to <code>resolvers</code> in <code>build.sbt</code></li>
<li>added following entries to application conf:</li>
</ul>

<p><code>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"
</code> </p>

<ul>
<li>took my entity and made it implement <code>Serializable</code>, also added <code>@com.avaje.ebean.annotation.Cache</code> annotation.</li>
<li>enabled SQL logging</li>
</ul>

<p><strong>What works?</strong></p>

<ul>
<li>loading entity with <code>Entity.find.byId(id)</code> results SQL <code>SELECT</code>. Loading it again with different request results no SQL statements.</li>
<li>opening browser to localhost:11211 shows errors in syslog -- this is to make sure memcached is running and I can see requests appearing</li>
<li>making memory dump I can see that cache related classes from <code>com.github.mumoshu</code> are loaded.</li>
</ul>

<p><strong>What doesn't work?</strong></p>

<ul>
<li>I expect cached objects to be sent to memcached (on read and/or update). This is not happening - there are no memcached logs related to this. Neither there are any connections to port 11211 if I run <code>netstat -na | grep 11211</code>.</li>
</ul>

<p>Is there anything I'm missing?</p>
