/
ISessionFactory.cs
33 lines (29 loc) · 1.03 KB
/
ISessionFactory.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using ServiceStack.Web;
namespace ServiceStack.Caching;
/// <summary>
/// Retrieves a User Session
/// </summary>
public interface ISessionFactory
{
/// <summary>
/// Gets the Session Bag for this request, creates one if it doesn't exist.
/// </summary>
/// <param name="httpReq"></param>
/// <param name="httpRes"></param>
/// <returns></returns>
ISession GetOrCreateSession(IRequest httpReq, IResponse httpRes);
ISessionAsync GetOrCreateSessionAsync(IRequest httpReq, IResponse httpRes);
/// <summary>
/// Gets the Session Bag for this request, creates one if it doesn't exist.
/// Only for ASP.NET apps. Uses the HttpContext.Current singleton.
/// </summary>
ISession GetOrCreateSession();
ISessionAsync GetOrCreateSessionAsync();
/// <summary>
/// Create a Session Bag using a custom sessionId
/// </summary>
/// <param name="sessionId"></param>
/// <returns></returns>
ISession CreateSession(string sessionId);
ISessionAsync CreateSessionAsync(string sessionId);
}