     concepts))
 
 (defn- fetch-and-cache-metadata
-  "TODO
-   use this if we want to provide easy caching"
+  "Fetches metadata from Metadata DB for the given concept tuples and converts them into the format
+   requested. The original native format and the requested format are both stored in the cache."
   [context concept-tuples target-format]
   (let [mdb-context (context->metadata-db-context context)
 

           "metadata-transformer/transform-concepts time:" t4)
    concept))


;; TODO throw this away
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; # Lookup logic
;; This should be unit testable without having to do any mocking. It should also be easy to tweak later.
;; Things skipping cache:
;; - granules
;; If in cache use that.
;; If cache miss
;; - specific revision is in cache but not format:
;;   - parse the native metadata and convert to that.
;;   - cache the requested format
;; - specific collection is in cache but newer revision:
;;   - Fetch revision from metadata db
;;   - convert to requested format.
;;   - cache requested format and native format. (others will be built as needed. The new revision
;;      will also be handled during a cache refresh.
;;   - Store the updated revision and remove the older revision.
;; - specific collection is in cache but older revision:
;;   - fetch revision from metadata db.
;;   - Convert to requested format
;;   - Do not cache this data (We don't want to cache every revision of collections because that
;;     could be a lot of metadata and I haven't checked sizing for this.



;; I think we can ignore all this. Get latest formatted conepts shouldn't be called for collections
;; We'll leave it in the transformer still working for collections but it won't be called that way.
; (defn get-latest-formatted-concepts
;   "Get latest version of concepts with given concept-ids in a given format."
;   [context concept-ids target-format skip-acls?]
;   (if (= :collection concept-type)
;     (let [condition (q/string-conditions :concept-id concept-ids)
;           concept-rev-tuples (fetch-collections-from-elastic
;                               context condition skip-acls?)])))
    ;; TODO granules
;
; ;; lookup logic here should be similar to above with exceptions:
; ;; - We will not know if there's a newer revision than what we have cached.


;; Current problem - how do we implement get-latest-formatted-concepts? Several options
;; granules direct fetch like in transformer
;; collections
;; - Get it from elasticsearch <-----
;; this seems like it's wrong to do here but
;; - Assume latest is in cache
;; -
;; -


;; ACLS are another monkey wrench
;; We could enforce acls during the search in elastic for collections.
;; For granules we implement basically exactly as it is right now.



(defn- fetch-metadata
  "Fetches metadata from Metadata DB for the given concept tuples and converts them into the format
   requested."
  [context concept-tuples target-format]
  (let [mdb-context (context->metadata-db-context context)
        ;; Get Concepts from Metadata db
