How-To: Share state between applications
Dapr provides different ways to share state between applications.
Different architectures might have different needs when it comes to sharing state. In one scenario, you may want to:
- Encapsulate all state within a given application
- Have Dapr manage the access for you
In a different scenario, you may need two applications working on the same state to get and save the same keys.
To enable state sharing, Dapr supports the following key prefixes strategies:
Examples
The following examples demonstrate what state retrieval looks like with each of the supported prefix strategies.
In the example below, a Dapr application with app id myApp
is saving state into a state store named redis
:
The key will be saved as myApp||darth
.
A Dapr application running in namespace production
with app id is saving state into a state store named redis
:
In the example below, a Dapr application with app id myApp
is saving state into a state store named redis
:
The key will be saved as redis||darth
.
In the example below, a Dapr application with app id myApp
is saving state into a state store named redis
:
The key will be saved as .