CLI Weather Application with Redis Caching
This repository hosts a simple Command-Line Interface (CLI) application that provides real-time weather information for selected cities and caches data using Redis to improve performance and reduce redundant API calls. The application is written in Java and uses a weather API to fetch live weather data.
Features
- City-based Weather Lookup: Fetches and displays current weather details (temperature, humidity, condition, etc.) for specified cities.
- Redis Caching: Implements Redis to cache weather data, minimizing API calls for frequently queried cities and expiring old data after a set time.
- Environmental Configuration: Uses
.env
files to manage API keys and Redis connection details for secure configuration. - Efficient CLI Design: Interactive CLI provides an intuitive way to access weather data and displays cached results if available.
Requirements
- Java (version 11 or above)
- Redis server (for caching data)
- Weather API Key from a provider (such as OpenWeatherMap or WeatherAPI)
Getting Started
- Clone this repository and navigate to the project directory.
- Configure your
.env
file with your Redis credentials and API key. - Start the Redis server, then run the application from the CLI.
Usage
java -jar weather_cli_app.jar
This application is ideal for those learning Java and exploring Redis caching strategies in simple CLI applications.