CodeLiturgy.Dashboard/BlueWest.Api/Session/ISessionCache.cs

57 lines
1.4 KiB
C#

using System.Threading.Tasks;
using BlueWest.Data.Application;
using BlueWest.WebApi.Context.Users;
using Microsoft.Extensions.Hosting;
namespace BlueWest.WebApi
{
/// <summary>
/// Methods for handling session cache data.
/// </summary>
public interface ISessionCache : IHostedService
{
/// <summary>
/// Gets a Session Token by Id.
/// </summary>
/// <param name="tokenId"></param>
/// <returns></returns>
Task<SessionToken> GetSessionTokenByIdAsync(string tokenId);
/// <summary>
/// Create a new session token
/// </summary>
/// <param name="token"></param>
Task AddSessionToken(SessionToken token);
/// <summary>
/// Check for validity of the session
/// </summary>
/// <param name="sessionTokenId"></param>
/// <returns></returns>
Task<bool> IsSessionValidAsync(string sessionTokenId);
/// <summary>
/// Checks if the session is valid
/// </summary>
/// <param name="sessionTokenId"></param>
/// <returns></returns>
bool IsSessionValid(string sessionTokenId);
/// <summary>
/// Save Cache
/// </summary>
/// <returns></returns>
Task SaveAsync();
/// <summary>
/// Save Cache
/// </summary>
/// <returns></returns>
void Save();
}
}