     (conj acc id)))
 
 (deftype CachedJdbcProcessorPersistence [db stream-batch stream-batch-size stream-cache stream-load-cache?
-                                         link-batch link-batch-size childs-cache childs-load-cache?]
+                                         link-batch link-batch-size childs-cache childs-load-cache?
+                                         parent-cache parent-load-cache?]
   ProcessorPersistence
   (init [this] (jdbc-init db) this)
   (stream-exists? [this dataset collection id]

    (-> (jdbc-last-stream-validity-and-action db dataset collection id) second))
  (childs [_ dataset parent-collection parent-id child-collection]
    (jdbc-get-childs db dataset parent-collection parent-id child-collection))
  (close [this] this)
  )


  (current-validity [this dataset collection id])
  (last-action [this dataset collection id])
  (childs [this dataset parent-collection parent-id child-collection])
  (parent [this dataset collection id] "Returns [collection id] tuple or nil")
  (close [_])
  )

(defn path [persistence dataset collection id]
  "Returns sequence of [collection id] tuples. Parents first. Root only means empty sequence"
  (when (and dataset collection id)
    (if-let [[parent-collection parent-id] (parent persistence dataset collection id)]
      (loop [path (list)
             pc  parent-collection
             pid parent-id]
        (if-let [[new-pc new-pid] (parent persistence dataset pc pid)]
          (recur (conj path [new-pc new-pid]) new-pc new-pid)
          path))
      (list))))

(defn root [persistence dataset collection id]
  "Return [collection id] tuple with self if no other root"
  (let [path (path persistence dataset collection id)]
    (if (empty? path)
      [collection id]
      (first path))))

(def ^:dynamic *jdbc-schema* :featured)
(def ^:dynamic *jdbc-features* :feature)
