使用 AWS Dynamodb 提供商删除过期 ASP.net 会话状态数据
Deleting Expired ASP.net Session State Data with AWS Dynamodb provider
我已经创建了一个新的 ASP.NET MVC 5 项目。我已经通过 Nuget 安装了适用于 .NET 的 AWS SDK 和 Session Provider,并且我在 Amazon 中阅读了 this article:文章
我在Web.Config
中有这个配置
<sessionState
mode="Custom"
customProvider="DynamoDBSessionStoreProvider">
<providers>
<add name="DynamoDBSessionStoreProvider"
type="Amazon.SessionProvider.DynamoDBSessionStateStore, AWS.SessionProvider"
AWSProfileName="default"
Table="ASP.NET_SessionState"
Region="eu-west-1"
/>
</providers>
</sessionState>
我正在寻找一些有关删除过期会话存储数据的资源
类似于
DeleteExpiredSessions.sql
和
ExpireUnusedSessions.sql
管理 AWS DynamoDb 中的过期数据
AWS 开发工具包提供了一个名为 DeleteExpiredSessions
的方法
描述为:
A utility method for cleaning up expired sessions that IIS failed to
delete. The method performs a scan on the ASP.NET_SessionState table
with a condition that the expiration date is in the past and calls
delete on all the keys returned. Scans can be costly on performance so
use this method sparingly like a nightly or weekly clean job.
我没用过,但听起来好像是由你来安排调用此方法的作业,而不是 运行 SQL 作业中的 SQL 语句MS SQL 世界中的调度程序。那么写一个调用它的 C# 程序并在 Windows 调度器中调度它?或使用 IIS 事件之一从您的 Web 应用程序异步调用它? (异步,否则,如果您正在使用该事件,您最终可能会长时间阻塞 Application_Start)
我已经创建了一个新的 ASP.NET MVC 5 项目。我已经通过 Nuget 安装了适用于 .NET 的 AWS SDK 和 Session Provider,并且我在 Amazon 中阅读了 this article:文章
我在Web.Config
中有这个配置 <sessionState
mode="Custom"
customProvider="DynamoDBSessionStoreProvider">
<providers>
<add name="DynamoDBSessionStoreProvider"
type="Amazon.SessionProvider.DynamoDBSessionStateStore, AWS.SessionProvider"
AWSProfileName="default"
Table="ASP.NET_SessionState"
Region="eu-west-1"
/>
</providers>
</sessionState>
我正在寻找一些有关删除过期会话存储数据的资源 类似于
DeleteExpiredSessions.sql 和 ExpireUnusedSessions.sql
管理 AWS DynamoDb 中的过期数据
AWS 开发工具包提供了一个名为 DeleteExpiredSessions
的方法
描述为:
A utility method for cleaning up expired sessions that IIS failed to delete. The method performs a scan on the ASP.NET_SessionState table with a condition that the expiration date is in the past and calls delete on all the keys returned. Scans can be costly on performance so use this method sparingly like a nightly or weekly clean job.
我没用过,但听起来好像是由你来安排调用此方法的作业,而不是 运行 SQL 作业中的 SQL 语句MS SQL 世界中的调度程序。那么写一个调用它的 C# 程序并在 Windows 调度器中调度它?或使用 IIS 事件之一从您的 Web 应用程序异步调用它? (异步,否则,如果您正在使用该事件,您最终可能会长时间阻塞 Application_Start)