Open
Description
Issue Summary
Currently, when the cache fails, an "AssertionError: You must call init first!" error is thrown, which is not user-friendly. Instead, the system should provide a warning message indicating that the results are not cached. Additionally, during the initialization function, it should log whether the connection to Redis was successful or not.
Steps to Reproduce the Issue
- Attempt to access cache results without initializing the cache.
- Observe the resulting error message.
Observed Behavior
An "AssertionError: You must call init first!" is thrown, disrupting the user experience.
Expected Behavior
- If the cache fails, a warning message should be displayed, informing the user that the results are not cached.
- During the cache initialization, the system should log whether the connection to Redis was established successfully.
Suggested Enhancements
Graceful Failure Handling
- Modify the cache access logic to check if the cache has been initialized.
- If not initialized, return a warning message instead of throwing an error.
- Example warning message: "Cache is not initialized. Results are not cached."
Logging Connection Status
- Enhance the init function to log the status of the connection to Redis.
- Example log messages:
- "Successfully connected to Redis."
- "Failed to connect to Redis."