Caching Proxy Server with interactive shell built using Spring Boot and Redis.
This project is a caching proxy server built using Spring Boot and Redis. It provides an interactive shell for users to clear the cache. The proxy server will forward requests to other servers and cache their responses to improve performance and reduce latency.
- Java 21.0.11
- Spring Boot 4.0.6
- Spring Shell 4.0.2
- Redis 8.6.2
- Request forwarding to target servers.
- Support for GET requests.
- Caching of HTTP responses using Redis.
- Interactive shell for cache clearing.
To run this project locally, you'll need:
- Java 21 or higher
- Redis server running on
localhost:6379
How to install and run the project:
-
Clone the repository:
git clone https://github.com/krisnaajiep/springboot-caching-proxy.git
-
Navigate to the project directory:
cd springboot-caching-proxy -
Build the project using Maven:
mvn clean install
-
Run the application:
java -jar target/springboot-caching-proxy-1.0.0.jar
If you run the application without any server options, the server will be accessible at http://localhost:8080. The server will forward requests to the default target server https://dummyjson.com.
Server started on http://localhost:8080
Server origin set to: https://dummyjson.com
If you want to specify a different port and target server, you can use the --server.port and --server.origin option
when starting the application. For example, to run the server on port 8081 and forward requests to https://jsonplaceholder.typicode.com,
you can use the following command:
java -jar target/springboot-caching-proxy-1.0.0.jar --server.port=8081 --server.origin=https://jsonplaceholder.typicode.comWhen you enter the interactive shell, you can type help command to see available commands or clear-cache to clear the Redis cache.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v4.0.6)
Welcome to the Spring Boot Caching Proxy Server with Interactive Shell
Server started on http://localhost:8081
Server origin set to: https://jsonplaceholder.typicode.com
Type 'help' to see available commands.
$>help
AVAILABLE COMMANDS
clear-cache: Clear the Redis cache
Built-In Commands
clear: Clear the terminal screen
help: Show help about available commands
quit, exit: Exit the shell
script: Execute commands from a script file
version: Show version info
$>clear-cache
Clearing all cache data...
Cache cleared successfully.
$>
Project is: complete.
This project was inspired by roadmap.sh.
This project is licensed under the MIT License - see the LICENSE file for details.