@NonNull
    public static Set<Geocache> loadCaches(final Collection<String> geocodes, final EnumSet<LoadFlag> loadFlags) {
        if (CollectionUtils.isEmpty(geocodes)) {
            return new HashSet<>();
        }

        return withAccessLock(() -> {

            final Set<Geocache> result = new HashSet<>(geocodes.size());
            final Set<String> remaining = new HashSet<>(geocodes);

            if (loadFlags.contains(LoadFlag.CACHE_BEFORE)) {
                for (final String geocode : geocodes) {
                    final Geocache cache = cacheCache.getCacheFromCache(geocode);
                    if (cache != null) {
                        result.add(cache);
                        remaining.remove(cache.getGeocode());
                    }
                }
            }

            if (loadFlags.contains(LoadFlag.DB_MINIMAL) ||
                    loadFlags.contains(LoadFlag.ATTRIBUTES) ||
                    loadFlags.contains(LoadFlag.WAYPOINTS) ||
                    loadFlags.contains(LoadFlag.CATEGORIES) ||
                    loadFlags.contains(LoadFlag.SPOILERS) ||
                    loadFlags.contains(LoadFlag.LOGS) ||
                    loadFlags.contains(LoadFlag.INVENTORY) ||
                    loadFlags.contains(LoadFlag.OFFLINE_LOG)) {

                final Set<Geocache> cachesFromDB = loadCachesFromGeocodes(remaining, loadFlags);
                result.addAll(cachesFromDB);
                for (final Geocache cache : cachesFromDB) {
                    remaining.remove(cache.getGeocode());
                }
            }

            if (loadFlags.contains(LoadFlag.CACHE_AFTER)) {
                for (final String geocode : new HashSet<>(remaining)) {
                    final Geocache cache = cacheCache.getCacheFromCache(geocode);
                    if (cache != null) {
                        result.add(cache);
                        remaining.remove(cache.getGeocode());
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(remaining)) {
                Log.d("DataStore.loadCaches(" + remaining + ") returned no results");
            }
            return result;
        });
    }
Load caches.

@return Set of loaded caches. Never null.
main/src/main/java/cgeo/geocaching/storage/DataStore.java