Caches: improve performance in soft/weak ref cache with 'clearCache()'. See #317