Commit 0fc6f779 by lcx

no message

parent c9cdca5e
...@@ -29,18 +29,21 @@ NotificationsService service ...@@ -29,18 +29,21 @@ NotificationsService service
private readonly MemoryCacheHelper helper = new MemoryCacheHelper(); private readonly MemoryCacheHelper helper = new MemoryCacheHelper();
public void LoginService(int userId) public void LoginService(string userId)
{ {
if (helper.Exists(userId))
helper.Remove(userId);
var dateTime = DateTime.Now; var dateTime = DateTime.Now;
var slidingtimespan = helper.ToUnixTimestampBySeconds(dateTime.AddMinutes(30)); var slidingtimespan = helper.ToUnixTimestampBySeconds(dateTime.AddMinutes(30));
var absolutetimespan = helper.ToUnixTimestampBySeconds(dateTime.AddHours(2)); var absolutetimespan = helper.ToUnixTimestampBySeconds(dateTime.AddHours(2));
helper.Set(userId.ToString(), Context.ConnectionId, slidingtimespan, absolutetimespan); helper.Set(userId, Context.ConnectionId, slidingtimespan, absolutetimespan);
} }
public void LogoutService(int userId) public void LogoutService(string userId)
{ {
if (helper.Exists(userId.ToString())) if (helper.Exists(userId))
helper.Remove(userId.ToString()); helper.Remove(userId);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment