Skip to content

softurk/springboot-docker-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot and Redis with Docker

Main Information

📖 Information

  • Redis is a caching process and it prevents every request coming from system from database
  • If there is any request which has been implemented system before, the response will be come from cache , otherwise the result is obtained from database process containing sql results.
  • It prevents traffic conjustion in system and comfort the usage of RAM
  • Here are the explation of this project
    • If a request of findAll is called in Postman, there is no cache procedure
    • If a request of finding any values which are located in h2 database like in first 3 values is called, there is a cache procedure
    • If a request of saving value is called in Postman is called, there is no cache procedure
    • If a request of finding any value which is stored by a save request is called, there is a cache procedure
    • ıf a request of finding any values with providing a cachable condition is firstly called, there is no cache procedure. When it is called before, there is a cache procedure
    • If a request of updating any value is called, there is no cache procedure
    • If a request of deleting any value is called, there is no cache procedure
  • While condition of Cachable means that a condition process which has been firstly evaluated by a invoked method determines if the data with the given key exists and it returns the result, unless of of Cachable means that the process looks up the cache which was called and returns the result after executing the method.

🔨 Run the App

1 ) Install Docker Desktop. Here is the installation link : https://docs.docker.com/docker-for-windows/install/

2 ) Run Redis on Docker Container

    docker run -p 6379:6379 --name my-redis -d redis

2 ) Show container which runs on Docker

    docker ps

3 ) Open h2 console to access its database

    http://localhost:8080/h2-console

4 ) Enter url,username and password which are defined in Spring datasource Properties in application.yml to login its database

    url: jdbc:h2:mem:testdb
    username: sa
    password: password

5 ) Determine if all values which are coming from data.sql under resources folder are stored.

6 ) To see all the employees, run this url with its GET request in Postman

http://localhost:8080/api/v1/employee/find/all

7 ) To see one of the employee, run this url with its GET request in Postman

http://localhost:8080/api/v1/employee/find/1

8 ) To save an employee, run this url with its POST request in Postman and write this body

http://localhost:8080/api/v1/employee/save

{
    "firstName": "Mark",
    "lastName": "Holly",
    "email": "[email protected]",
    "phone": "111-222-4444"
}

9 ) To update of any employee, run this url with its PUT request in Postman and write this body

http://localhost:8080/api/v1/employee/update/4

{
    "firstName": "James",
    "lastName": "Holly",
    "email": "[email protected]",
    "phone": "111-222-5555"
}

10 ) To delete of any employee, run this url with its DELETE request in Postman

http://localhost:8080/api/v1/employee/delete/4

Screenshots

Click here to show the screenshots of project

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Figure 9

Figure 10

Figure 11

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages