gpt4 book ai didi

asp.net - 存储 ASP.NET session 状态时 AppFabric 缓存的新缓存参数

转载 作者:行者123 更新时间:2023-12-04 15:37:37 26 4
gpt4 key购买 nike

当您将 session 状态存储在缓存中时,用于创建 AppFabric 缓存的“最佳”参数是什么? MSDN Cache-Related Commands

Powershell 命令行:

New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>]
  • 缓存名称:<应用程序名称>- session 状态
  • 辅助节点:1(在服务器出现故障时开启高可用性)
  • 驱逐:?
  • 过期: ?
  • 生存时间:?
  • 力量: ?
  • 通知已启用:?

  • 由于我不希望我的 session 被删除,除非 session 已通过代码或 session 超时被放弃...

    对于驱逐,我会认为“无”,对于可过期,我会认为是 False。

    我已经测试并调用 Session.Abandon 确实从缓存中删除了对象。我还测试了通过扩展我的 session ,是否也扩展了缓存中的 session 对象。这似乎确实以“正确”的方式工作。

    最佳答案

    post来自 MS 员工的消息证实了我的发现。

    2) Since your question is in the context of session state, when you use the session state provider, the session object is stored in the cache with a timeout equal to the ASP.Net session timeout. Each time the session is accessed, the timeout of the session object in the cache is also reset to the session timeout. It is made sure that the session object expires from the cache only when the ASP.Net session times-out.session times-out.



    我仍然需要创建一个命名缓存来获得高可用性,但看起来我可以将其他设置保留为默认值。
    New-Cache projectname-session-state -Secondaries 1

    关于asp.net - 存储 ASP.NET session 状态时 AppFabric 缓存的新缓存参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3355571/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com