Hello Andrea Manov,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand based on your explanations that you would like to use same instance of Azure Cache for Redis Enterprise (E1) for two environments and you need how you can create separate db, also you're asking if there any limit of the number of dbs because of the tier and you would like to find Microsoft documentation associated with that.
Solution
To use the same instance of Azure Cache for Redis Enterprise (E1) for two environments (test and staging), you can create separate databases within the same Redis instance. I will provide the solution based on the core questions:
How can I create separate db?
You can use different database indexes for each environment. For example, use database 0 for the test environment and database 1 for the staging environment.
- Use your preferred Redis client to connect to your Azure Cache for Redis instance.
- Check the number of available databases:
CONFIG GET databases
- Use the
SELECT
command to switch to the desired database:SELECT 1
You can replace1
with any valid database index. - After switching, you can add keys to the selected database:
SET mykey ``"value"
- Switch to Database 0 for the Test Environment:
SELECT 0
- Now, add keys specific to the test environment:
SET testKey "testValue"
- Switch to Database 1 for the Staging Environment:
SELECT 1
- Now, add keys specific to the staging environment:
SET stagingKey "stagingValue"
Is there any limit of the number of dbs because of the tier?
Yes, the number of databases you can use depends on the tier of your Redis instance. For Azure Cache for Redis Enterprise (E1) Tier:
- The default number of databases is usually 16.
- This can be configured up to 256 databases depending on the specific Enterprise tier you are using.
You can verify and set this number using the CONFIG
command:
CONFIG GET databases
CONFIG SET databases 16``# Example to set it to 16
I was trying to find in the Microsoft documentation, but I couldn't.
The followings are Microsoft documentation as requested:
- Azure Cache for Redis Documentation: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/
- Configure Azure Cache for Redis: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-configure
- Redis Databases: https://redis.io/topics/data-types-intro#redis-databases
References
Kindly use the available additional resources provided by the right side of this page.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam