Added generic LRU cache and implementation for resource cache.

Updated ResourceIndex to use these LRU caches instead of the old
implementations.