Package java8guide.cache

Source Code of java8guide.cache.JavaCache$News

/*
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package java8guide.cache;

import org.junit.Test;
import play.cache.CacheApi;
import play.test.WithApplication;

import static org.junit.Assert.*;

public class JavaCache extends WithApplication {

    public class News {}

    private News lookUpFrontPageNews() {
        return new News();
    }

    @Test
    public void getOrElse() {
        CacheApi cache = app.getWrappedApplication().injector().instanceOf(CacheApi.class);

        //#get-or-else
        News maybeCached = cache.getOrElse("item.key", () -> lookUpFrontPageNews());
        //#get-or-else

        assertNotNull(maybeCached);
    }
}
TOP

Related Classes of java8guide.cache.JavaCache$News

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.