I have a session concept that stores objects in different states.
Sometimes I need to scan a session for objects matching a specific request, but I do it a lot, and performance testing has shown that it becomes a bottleneck in some areas.
Therefore, I would like to introduce the concept of indexes in a session.
Something like...
public IDictionary<K, V> GetIndex<K, V>(Func<V, K> keySelector)
However, I'm not sure how to test Func βequalityβ like this. Obviously, I want the index to be built only on the first call to GetIndex and subsequent calls, so as not to build it again.
How should I display them inside in order to search for the existence of an index?
IDictionary<???, IDictionary<K, V>> indexes = ...
Basically, how should I store ???. Maybe I can't do it with Func, but maybe there is another way.
Mike q
source share