【问题标题】:Can Play Cache be used outside of Play?Play Cache 可以在 Play 之外使用吗?
【发布时间】:2018-08-29 22:58:04
【问题描述】:

我正在尝试理解https://www.playframework.com/documentation/2.6.x/JavaCache,但看不到如何将其合并到 Akka 项目中。特别是,这些例子是不完整的。例如

import play.cache.*;
import play.mvc.*;

import javax.inject.Inject;

public class Application extends Controller {

    private AsyncCacheApi cache;

    @Inject
    public Application(AsyncCacheApi cache) {
        this.cache = cache;
    }

    // ...
}

如何实例化应用程序,例如在单元测试用例中?我实际上在哪里获取一个 AsynchCacheApi 实例以传递给新的应用程序(缓存)?

【问题讨论】:

    标签: java caching playframework akka


    【解决方案1】:

    不要使用播放缓存,而是使用https://doc.akka.io/docs/akka-http/current/common/caching.html

    【讨论】:

      猜你喜欢
      • 2013-03-11
      • 2015-12-16
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-22
      相关资源
      最近更新 更多