We have HTTP sessions in on-premise application. We want to migrate application to Cloud. We got the direction to use REDIS cache implementation in Cloud to replace HTTP sessions.
Do we save user specific(HTTP Session) data in REDIS? Is there any other elegant way to handle this scenario?
Thanks in advance.
2
Answers
Assuming you’re talking about a legacy app, you can set Redis (Azure Redis Cache) as your State Provider.
Here’s a link about it:
https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-aspnet-session-state-provider
Yes it is possible and Redis is one of the pinpoint solutions for this kind of requirements. It is super fast in-memory key/value store just like sessions(get/set). Most of the modern frameworks come along with built-in session support for Redis. Even it is a legacy app, you may integrate easily(there could some libraries that do that). You may just use commands such as
SET
,GET
,EXPIRE
,EXISTS
,DEL
for a session store.If it is going to be just string/string you may go with string, if you have some json values you may use hash. Both solutions provide
EXPIRE
option for you to not store forever and manage your memory.I am not familiar with Azure side but AWS has ElastiCache service that supports Redis. Another option could be installing one in a EC2 instance for on-prem.