相关链接{ https://github.com/mumoshu/play2-memcached}
环境{ playframework2(2.3.6) memcached(1.4.21)}1.配置build.sbt
添加lib依赖: "com.github.mumoshu" %% "play2-memcached" % "0.6.0"
样例
libraryDependencies ++= Seq(
javaJdbc, javaEbean, javaWs, cache, "com.github.mumoshu" %% "play2-memcached" % "0.6.0")2.配置插件
在play.plugins(如果没有则新建一个, 建议放在conf目录下)
添加: 5000:com.github.mumoshu.play2.memcached.MemcachedPlugin
3.修改配置文件application.conf
添加:
ehcacheplugin=disabled #关闭默认缓存插件
memcached.host="127.0.0.1:11211" # memcached host配置4. 测试
import play.cache.Cache;...Cache.set("key", "value");Cache.get("key");...