问题
Memory is good for speed, but is limited, and therefore requires session time limits which then discard the session information permanently.
Database is good for volume storage and catering for more users concurrently and having longer session times. But the increased latency per request is a significant overhead.
How can I configure ASP.Net to use an SQL Database (or other database for that matter), and cache the most recent used Session data in memory?
It would seem there is no inbuilt configuration option ready to go.
Update:
- By "Session" I refer to the server-side Session store:
var userID = Session["UserID"]
来源:https://stackoverflow.com/questions/51922302/how-can-i-store-session-information-in-a-hybrid-database-memory-way