8000 make the cache specific to the transformer instance instead of being … by esuomi · Pull Request #23 · esuomi/muotti · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

make the cache specific to the transformer instance instead of being … #23

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/clj/muotti/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
[(inc index) (str content "\n\t" from "([" from "]) --> "to"([" to "])")])
[0 "flowchart TD"])
second))
(def ^:private resolved-paths (atom {}))

(defn ->transformer
"Creates a new [[Transformer]] instance from given map of adjacencies and related configuration. By default uses
[[default-adjacencies]], but the map of adjacency lists to validation and transformation functions can be overridden.
Expand All @@ -112,7 +112,8 @@
([] ->transformer default-config)
([{:keys [transformations]
:as config}]
(let [graph (adjacencies-as-graph transformations)]
(let [resolved-paths (atom {})
graph (adjacencies-as-graph transformations)]
(reify Transformer
(transform [_ from to value]
(if-let [cached-chain (get @resolved-paths [from to])]
Expand Down
0