public static boolean isThere(final String geocode, final String guid, final boolean checkTime) {
        return withAccessLock(() -> {

            init();

            long dataDetailedUpdate = 0;
            int dataDetailed = 0;

            try {
                final Cursor cursor;

                if (StringUtils.isNotBlank(geocode)) {
                    cursor = database.query(
                            dbTableCaches,
                            new String[]{"detailed", "detailedupdate", "updated"},
                            "geocode = ?",
                            new String[]{geocode},
                            null,
                            null,
                            null,
                            "1");
                } else if (StringUtils.isNotBlank(guid)) {
                    cursor = database.query(
                            dbTableCaches,
                            new String[]{"detailed", "detailedupdate", "updated"},
                            "guid = ?",
                            new String[]{guid},
                            null,
                            null,
                            null,
                            "1");
                } else {
                    return false;
                }

                if (cursor.moveToFirst()) {
                    dataDetailed = cursor.getInt(0);
                    dataDetailedUpdate = cursor.getLong(1);
                }

                cursor.close();
            } catch (final Exception e) {
                Log.e("DataStore.isThere", e);
            }

            if (dataDetailed == 0) {
                // we want details, but these are not stored
                return false;
            }

            if (checkTime && dataDetailedUpdate < (System.currentTimeMillis() - DAYS_AFTER_CACHE_IS_DELETED)) {
                // we want to check time for detailed cache, but data are older than 3 days
                return false;
            }

            // we have some cache
            return true;
        });
    }
Remove obsolete cache directories in c:geo private storage.
Also removes caches marked as "to be deleted" immediately (ignoring 72h grace period!)
main/src/main/java/cgeo/geocaching/storage/DataStore.java