Skip to content

Commit

Permalink
update to use memof-call; bump 0.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Feb 25, 2021
1 parent 3691c15 commit 5f12588
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 229 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ Cached rendering and diff/patch library designed for Cumulo project.
### API [![Clojars Project](https://img.shields.io/clojars/v/cumulo/recollect.svg)](https://clojars.org/cumulo/recollect)

```clojure
[cumulo/recollect "0.6.2"]
[cumulo/recollect "0.6.4"]
```

```clojure
(recollect.twig/deftwig twig-name [param] body)
(recollect.twig/clear-twig-caches!)
(recollect.twig/new-twig-loop!)
(recollect.diff/diff-twig a b {:key :id})
Expand Down
260 changes: 98 additions & 162 deletions calcit.cirru

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
:paths ["src" "polyfill"]
:paths ["src"]
:deps {
cumulo/memof {:mvn/version "0.2.3"}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "recollect",
"version": "0.6.3",
"version": "0.6.4",
"description": "Recollect data renderer",
"main": "index.js",
"scripts": {
Expand All @@ -23,6 +23,6 @@
"author": "jiyinyiyong",
"license": "MIT",
"devDependencies": {
"shadow-cljs": "^2.11.15"
"shadow-cljs": "^2.11.18"
}
}
10 changes: 0 additions & 10 deletions polyfill/recollect/twig.clj

This file was deleted.

2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.6.3",
{:version "0.6.4",
:group-id "cumulo",
:artifact-id "recollect",
:skip-tag true,
Expand Down
4 changes: 2 additions & 2 deletions shadow-cljs.edn
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
:source-paths ["src" "polyfill" "cli"]
:source-paths ["src" "cli"]
:cache-blockers #{cumulo-util.build}
:dependencies [
[mvc-works/hsl "0.1.2"]
[mvc-works/shell-page "0.1.15"]
[respo "0.13.4"]
[respo "0.13.9"]
[respo/ui "0.3.16"]
[cumulo/util "0.1.12"]
[cumulo/memof "0.2.3"]
Expand Down
4 changes: 2 additions & 2 deletions src/recollect/app/twig/card.cljs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

(ns recollect.app.twig.card (:require [recollect.twig :refer [deftwig]]))
(ns recollect.app.twig.card (:require ))

(deftwig twig-card (user date) {:user user, :date date})
(defn twig-card [user date] {:user user, :date date})
8 changes: 2 additions & 6 deletions src/recollect/app/twig/container.cljs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@

(ns recollect.app.twig.container
(:require [recollect.app.twig.card :refer [twig-card]] [recollect.twig :refer [deftwig]]))
(ns recollect.app.twig.container (:require [recollect.app.twig.card :refer [twig-card]]))

(deftwig
twig-container
(store)
(merge store {:card (twig-card (:user store) (:date store))}))
(defn twig-container [store] (merge store {:card (twig-card (:user store) (:date store))}))
7 changes: 3 additions & 4 deletions src/recollect/test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
[recollect.diff :refer [diff-twig]]
[recollect.patch :refer [patch-twig]]
[recollect.schema :as schema]
[recollect.util :refer [vec-add seq-add]]
[recollect.twig :refer [deftwig]]))
[recollect.util :refer [vec-add seq-add]]))

(deftest
test-diff-funcs
()
(let [A (deftwig twig-a0 (f) (f))
B (deftwig twig-b0 (f) (f))
(let [A (defn twig-a0 [f] (f))
B (defn twig-b0 [f] (f))
fx (fn [] "x")
a0 (A fx)
b (B fx)
Expand Down
22 changes: 8 additions & 14 deletions src/recollect/twig.cljs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@

(ns recollect.twig (:require [memof.core :as memof]) (:require-macros [recollect.twig]))
(ns recollect.twig
(:require [memof.core :as memof]
[memof.alias
:refer
[*memof-call-states reset-calling-caches! tick-calling-loop!]]))

(defonce *twig-caches (atom (memof/new-states {})))
(defn clear-twig-caches! [] (reset-calling-caches!))

(defn call-twig-func [f params]
(let [v (memof/access-record *twig-caches f params)]
(if (some? v)
v
(let [result (apply f params)]
(memof/write-record! *twig-caches f params result)
result))))
(defn new-twig-loop! [] (tick-calling-loop!))

(defn clear-twig-caches! [] (memof/reset-entries! *twig-caches))

(defn new-twig-loop! [] (memof/new-loop! *twig-caches))

(defn show-twig-summay [] (memof/show-summary @*twig-caches))
(defn show-twig-summay [] (memof/show-summary @*memof-call-states))
46 changes: 23 additions & 23 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f12588

Please sign in to comment.