Giter VIP home page Giter VIP logo

bashful-straw's Introduction

Cache - Spring Boot Example Application

Important

While you can run and interact with this example application on localhost, it requires that you also have a cache server installed and configured. This example application runs best when deployed on OpenShift with a JBoss Data Grid cache server. For more details on using this example application with a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the Spring Boot Runtime Guide.

Important
This exampe application requires Java 8 JDK or greater and Maven 3.3.x or greater.
Important
As part of the process of creating this example application using developers.redhat.com/launch or the Fabric8 Launcher tool, set up a project with a CI/CD deployment of this example application. You can see the status of this deployment in your Single-node OpenShift Cluster or OpenShift Online Web Console.

Running the Example Application on a Single-node OpenShift Cluster

If you have a single-node OpenShift cluster, such as Minishift or Red Hat Container Development Kit, installed and running, you can also deploy your example application there. A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.

To deploy your example application to a running single-node OpenShift cluster:

  1. Navigate to the root directory of your example application.

    $ git clone [email protected]:hazel-shen/bashful-straw
    
    $ cd bashful-straw
  2. Log in and create your project.

    $ oc login -u developer -p developer
    
    $ oc new-project MY_PROJECT_NAME
  3. Deploy the cache service.

    $ oc create -f service.cache.yml
  4. Deploy your example application.

    $ mvn clean fabric8:deploy -Popenshift

Interacting with the Example Application on a Single-node OpenShift Cluster

  1. Determine the URL of the greeting service.

    $ oc get route ${value-name-app} -o jsonpath={$.spec.host}
    
    ${value-name-app}-MY_PROJECT_NAME.LOCAL_OPENSHIFT_HOSTNAME
  2. Navigate to the greeting service using your browser.

  3. Click Invoke the service once.

    Notice the duration value is above 2000. Also notice the cache state has changed form No cached value to A value is cached.

  4. Wait 5 seconds and notice cache state has changed back to No cached value.

    The TTL for the cached value is set to 5 seconds. Once the TTL expires, the value is no longer cached.

  5. Click Invoke the service once more to cache the value.

  6. Click Invoke the service a few more times over the course of a few seconds while cache state is A value is cached.

    Notice a significantly lower duration value since it is using a cached value. If you click Clear the cache, the cache is emptied.

More Information

You can learn more about this example application and the Spring Boot runtime in the Spring Boot Runtime Guide.

Note
Run the set of integration tests included with this example application using mvn clean verify -Popenshift,openshift-it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.