Play Framework 2.2 (scala) play.api.cache not incl

2019-08-04 09:25发布

问题:

I am using play 2.2 (scala). I can not import play.api.cache._ as it is not found. I assume that it is not included as part of the standard download? How can I enable/get it. Do I need to included it manually in SBT build profile?

Strange that an important component like caching is not included as standard.

Thanks

回答1:

That's correct. According to the migration guide:

Play cache is now split out into its own module. If you are using the Play cache, you will need to add this as a dependency. For example, in Build.scala:

val addDependencies = Seq(
   jdbc,
  cache,
  ...
)

Or if you're using build.sbt, you can add it there. cache seems to be included automatically in the generated build.sbt for new 2.2.x projects.