This fixes a race condition in the Weak and Soft reference caches.

o Get-or-put now guards for GC collecting the reference while we are handling it
o Consolidated Soft and Weak LRU caches into one parent class and factories instead, reducing duplication.
Merge pull request #1324 from jakewins/fix-for-chain-loading-test

This fixes a race condition in the Weak and Soft reference caches.