Upstash Redis Cache
Overview​
The Upstash Redis Cache feature in AnswerAgentAI allows you to store Language Model (LLM) responses using Upstash Redis, a serverless data solution for Redis. This caching mechanism improves performance by storing and retrieving responses for repeated queries, eliminating the need for redundant API calls while leveraging the scalability and ease of use of a serverless architecture.
Key Benefits​
- Faster response times for repeated queries
- Reduced API usage, potentially lowering costs
- Serverless architecture for easy scalability
- No infrastructure management required
- Global distribution for low-latency access
How to Use​
-
Set up an Upstash Redis account:
- Sign up for an Upstash account at https://upstash.com/
- Create a new Redis database
- Note down the Redis connection URL and token
-
Configure the Upstash Redis Cache credential in AnswerAgentAI:
- Navigate to the credentials section in AnswerAgentAI
- Create a new credential of type 'upstashRedisApi'
- Enter your Upstash Redis connection URL and token

Upstash Redis Cache API Credential & Drop UI
-
Add the Upstash Redis Cache node to your AnswerAgentAI workflow:

Upstash Redis Cache Node & Drop UI
-
Configure the Upstash Redis Cache node:
- Connect the previously created credential to the node
-
Connect the Upstash Redis Cache node to your LLM node:

Upstash Redis Cache In a Workflow & Drop UI
-
Run your workflow:
- The first time a unique prompt is processed, the response will be cached in Upstash Redis
- Subsequent identical prompts will retrieve the cached response, improving performance
Tips and Best Practices​
-
Optimize cache usage:
- Use caching for stable, non-dynamic content
- Ideal for frequently asked questions or standard procedures
- Avoid caching for time-sensitive or rapidly changing information
-
Monitor cache performance:
- Use Upstash's dashboard to monitor cache usage, hit rates, and performance metrics
- Adjust your caching strategy based on observed patterns
-
Secure your Upstash credentials:
- Keep your Upstash connection URL and token confidential
- Use environment variables or secure credential management systems
-
Implement error handling:
- Add appropriate error handling in your workflow to manage potential cache connection issues
-
Consider data privacy:
- Ensure that caching sensitive information complies with your data privacy policies and regulations
-
Leverage Upstash features:
- Explore Upstash's global replication for multi-region low-latency access
- Utilize Upstash's automatic scaling capabilities for high-traffic scenarios