private static List<StoredList> getStoredLists(@Nullable final Integer listId) {

        return withAccessLock(() -> {

            if (!init(false)) {
                return Collections.emptyList();
            }

            final Resources res = CgeoApplication.getInstance().getResources();
            final List<StoredList> lists = new ArrayList<>();
            if (listId == null) {
                lists.add(new StoredList(StoredList.STANDARD_LIST_ID, res.getString(R.string.list_inbox), EmojiUtils.NO_EMOJI, false, (int) PreparedStatement.COUNT_CACHES_ON_STANDARD_LIST.simpleQueryForLong()));
            }

            try {
                final String query = "SELECT l._id AS _id, l.title AS title, l.emoji AS emoji," +
                        " l." + FIELD_LISTS_PREVENTASKFORDELETION + " AS " + FIELD_LISTS_PREVENTASKFORDELETION + "," +
                        " COUNT(c.geocode) AS count" +
                        " FROM " + dbTableLists + " l LEFT OUTER JOIN " + dbTableCachesLists + " c" +
                        " ON l._id + " + customListIdOffset + " = c.list_id" +
                        (listId == null ? "" : " WHERE l._id = " + String.valueOf(listId - customListIdOffset)) +
                        " GROUP BY l._id" +
                        " ORDER BY l.title COLLATE NOCASE ASC";

                lists.addAll(getListsFromCursor(database.rawQuery(query, null)));
            } catch (final Exception e) {
                Log.e("DataStore.readLists", e);
            }
            return lists;
        });
    }
Drop caches from the tables they are stored into, as well as the cache files

@param geocodes list of geocodes to drop from cache
main/src/main/java/cgeo/geocaching/storage/DataStore.java