title: When caching identities, should it be Singleton or Scoped?
body: <p>When caching identity information for multiple kinds of users, specially where key conflict in a single cache object may happen, I usually partition the cache by creating custom cache classes: </p>
  
  <pre><code>public BackEndUserCache: MemoryCache {
    ...
  }
  public FrontEndUserCache: MemoryCache {
    ...
  }
  </code></pre>
  
  <p>I've been thinking for quite a while about whether I have to inject the dependencies as Singleton or Scoped?</p>
  
  <p>To clarify: </p>
  
  <p>1- I think that if I bind these to <code>IMemoryCache</code> as Singleton, there may be a security flaw as the credentials for all users will be cached in a single global cache list. </p>
  
  <p>2- If I bind it in a Scoped way, the cache object will be created per each connection, and will be expired which the session is terminated. But would this make sense when caching?  </p>