wangengzheng / RedisSessionStateProvider

redis session
0 stars 1 forks source link

Can we use same azure portal sample application to store sessions and cache on redis cache? #1

Open Najjaf opened 7 years ago

Najjaf commented 7 years ago

Hi guys, I am implementing redis cahce in my ongoing application in which i have successfully implemented redis cache for session state and now sessions are storing on redis cache.

Similarly now i have to move current caching implementation on redis cahce for which i have implemented in below code snippet(in vb.net),

Public Function GetApplicationCacheData() As DataSet Const rawKey As String = "AKey_" Dim dsData As DataSet Dim connection As ConnectionMultiplexer = ConnectionMultiplexer.Connect("webapplication1.redis.cache.windows.net:6280,password=some password,ssl=True,abortConnect=False") Dim redisObj As IDatabase = connection.GetDatabase() Dim valueObj As RedisValue = redisObj.StringGet(rawKey)

        If Not valueObj.HasValue Then
            dsData = class1.GetApplicationCacheData()
            redisObj.StringSet(rawKey,JsonConvert.SerializeObject(dsData), TimeSpan.FromMinutes(90))
        Else
            dsData  = JsonConvert.DeserializeObject(Of DataSet)(redisObj.StringGet(rawKey))
        End If

        Return dsData
    End Function

Now problem is this caching implementation working fine if i run it separately from session state but when i implement session state and caching together in redis cache then sessions become null and page redirects to login page with form authentication.

We created one test application on azure portal and using same for session state and caching storage.

So my question is, can we use one application for both implementation or we should create another application on portal to run cache functionality in redis cahce or My implementation has some inconsistency?

wangengzheng commented 7 years ago

Thank you very much this is the first time to answer .If the session is separated from the proposed use of nginx ip_hash do not know with your solution is consistent