卡桑德拉静态会话?

Cassandra static session?

Web 应用程序中的 ClusterISessionIMapper 实例是否可以是静态的,或者我们需要为每个用户提供单独的实例? IE。在应用程序启动时将所有这些实例化(as static)然后将它们用于所有用户是否可以?在 documentation it says that only one instance of ISession should be used per keyspace. I'm using only one keyspace, so is this OK, or would this be problematic? I'm using DataStax C# Driver.

事实上,您只需要一个 ISession 应用程序实例,即单例模式。

但是,如果预计会有大量负载,请确保您保护它的创建免受您正在使用的任何托管环境的多次尝试,以便在建立会话时再次尝试失败。