mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-21 02:57:54 +08:00
add missing files
This commit is contained in:
61
Infrastructure/Cache/SessionContext.cs
Normal file
61
Infrastructure/Cache/SessionContext.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : Infrastructure
|
||||
// Author : yubaolee
|
||||
// Created : 06-21-2016
|
||||
//
|
||||
// Last Modified By : yubaolee
|
||||
// Last Modified On : 06-21-2016
|
||||
// Contact :
|
||||
// File: EnyimMemcachedContext.cs
|
||||
// ***********************************************************************
|
||||
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace Infrastructure.Cache
|
||||
{
|
||||
public sealed class SessionContext : CacheContext
|
||||
{
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public override T Get<T>(string key)
|
||||
{
|
||||
return (T) HttpContext.Current.Application[key];
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T t)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpContext.Current.Application[key] = t;
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Remove(string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpContext.Current.Application[key] = null;
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user