0

Building an mvc site using Identity 2.1 and a custom user model. There's some info in the user model that I need in almost every controller. Calling FindByNameAsync each time hits the db more than I think necessary.

If there are a few small strings and/or int's that I need often, is the best idea to add them as claims to the identity when the person logs in?
identity.AddClaim(new Claim("MyInfo", "xyz"));

Or is there a more accepted practice, such as caching the user object in redis (or equivalent)?

Wavel
  • 956
  • 8
  • 31

1 Answers1

0

Wavel, today store some user information that you need access this info faster, is very recommended to store it into identity claims, is best practices. But, it's not recommended that you stores any information or long information into identity claims, 'cause this identity claims infos are stored into the cookies after user login into the application.