Share via

Azure Managed Redis - REST API to flush

Eddy Lynch 60 Reputation points Microsoft Employee
2026-04-28T08:38:07.4033333+00:00

Hello,

I am using Azure Managed Redis (redis enterprise), and I tried using the Azure management rest api "Microsoft.Cache/redisEnterprise/<cluster-name>/databases/default/flush"

I get a successful result on the operation. However, I notice the cache is still at 2GB used memory

Azure Cache for Redis
Azure Cache for Redis

An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.


Answer accepted by question author

Pilladi Padma Sai Manisha 8,410 Reputation points Microsoft External Staff Moderator
2026-04-28T09:28:54.1866667+00:00

Hi Eddy Lynch,
Thankyou for reaching microsoft Q&A!
From what you’ve described, the flush call itself is working as expected in Azure Managed Redis, and the memory behavior you’re seeing is normal.

When you call the …/databases/default/flush API, it clears all keys from the database. However, Redis doesn’t immediately return freed memory back to the OS. Instead, it keeps that memory reserved for reuse, which is why the “used memory” metric can still show around ~2 GB even after a successful flush.

It’s also worth noting that the flush operation is asynchronous (returns a 202), so you should make sure the operation has fully completed by checking the Azure-AsyncOperation or Operation-Location endpoint. That said, even after it reports Succeeded, the memory metric may still look unchanged due to how Redis manages memory internally.

To confirm the flush actually worked, it’s better to validate at the data level. For example, running DBSIZE should return 0, INFO keyspace should show no keys, and any previously stored key should no longer be available. Those checks will confirm the cache is empty regardless of what the memory metric shows.

You might also see a small delay in Azure Monitor metrics updating, so it can help to wait a minute or two and refresh.

If your cache is part of an Active Geo-Replication setup, make sure the flush is performed at the group level as documented, otherwise the standard database flush should be sufficient.

If your goal is to actually reduce the reported memory usage, that typically only happens after a restart or scaling operation, since that’s when the allocator is reset.
When the flush happened, all existing keys would have been cleared, which explains the drop from ~8 to ~3. The current count likely reflects services restarting and gradually repopulating the cache with only the keys they immediately need.

This is generally expected for cache-backed workloads. You should see the key count increase over time as the application continues to rebuild its cache.

For reference: https://learn.microsoft.com/azure/azure-cache-for-redis/cache-administration#flush-data https://learn.microsoft.com/azure/azure-cache-for-redis/cache-best-practices-memory-management/ https://learn.microsoft.com/azure/azure-cache-for-redis/managed-redis/managed-redis-how-to-active-geo-replication#flush-operation

Let me know if you want help validating this on your cluster or checking anything specific.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.