BruceCowan-AI/ServiceStack.OrmLite — pull request #1 by jessemcdowell-AI (2014-09-11 00:35:15+00:00)
Title: Switch cache to use weak reference

Since I had nothing better to do, I tried switching the cache to use WeakReference.

I dropped a couple of the cache purge tests, because I couldn't think of an easy way to test them any more. Even after the interval, the items will still be cached if the connection wasn't garbage collected.

Another quirk of this implementation: I'm not searching the cache for pre-existing items for the same connection. I started down that path, but I suspect that scanning references may not be very fast, and it added a lot more locking code. This implementation has the disadvantage that if someone does hold a connection for a long time, the cache will grow every time they do an insert, and never shrink.