diff mbox series

[bug#53765,04/17] gnu: Add clojure-core-cache.

Message ID 87sfsz32d8.fsf@reilysiegel.com
State New
Headers show
Series Remove limitations on clojure-tools | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Reily Siegel Feb. 4, 2022, 12:24 a.m. UTC
* gnu/packages/clojure.scm (clojure-core-cache): New variable.
---
 gnu/packages/clojure.scm | 55 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

Comments

M March 17, 2022, 8:44 p.m. UTC | #1
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +Implementations of some basic caching strategies
> +
> +First-in-first-out (FIFOCache)
> +Least-recently-used (LRUCache)
> +Least-used (LUCache -- sometimes called Least Frequently Used)
> +Time-to-live (TTLCacheQ)
> +Naive cache (BasicCache)
> +Naive cache backed with soft references (SoftCache)

Texinfo has some markup for lists, maybe @itemize (not sure)?
M March 17, 2022, 8:45 p.m. UTC | #2
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +    (description "@code{core.cache} is a Clojure contrib library providing the
> +following features:

What's a ‘contrib’ library?  What is the importance of this library is
considered ‘contrib’?

Greetings,
Maxime.
M March 17, 2022, 8:47 p.m. UTC | #3
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +A defcache macro for hooking your CacheProtocol implementations into the

'defcache' is the name of Lisp (in this case, the Lisp is Clojure)
macro, so @lisp might be appropriate.

Greetings,
Maxime.
M March 17, 2022, 8:50 p.m. UTC | #4
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +A defcache macro for hooking your CacheProtocol implementations into the
> +Clojure associative data capabilities.

I don't think that clojure-core-cache cares whether it's my
CacheProtocol implementation, yours, someone elses or nobodies.
WDYT of dropping the 'your'?

Greetings,
Maxime.
M March 17, 2022, 8:57 p.m. UTC | #5
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +A defcache macro for hooking your CacheProtocol implementations into the
> +Clojure associative data capabilities.

‘hooking foo into bar’ and ‘associative data capabilities’ seems rather
wordy, WDYT of

 ‘A @lisp{defcache} macro for defining key-value caches that implement
the standard collection interfaces."

?  That seems much clearer to me and (AFAICT) not any less accurate.

Greetings,
Maxime.
M March 17, 2022, 8:59 p.m. UTC | #6
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +The @code{clojure.core.cache} namespace contains the immutable caches
> +themselves.  The @code{clojure.core.cache.wrapped} namespace contains the same
> +API operating on caches wrapped in atoms, which is the \"normal\" use in the
> +wild.")

What exactly namespaces are used, seems more something for the
documentation of clojure-core-cache to me, and not very relevant for a
potential user that needs to choose between several packages.

Greetings,
Maxime.
M March 17, 2022, 9 p.m. UTC | #7
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +Implementation of an efficient buffer replacement policy based on the low
> +inter-reference recency set algorithm (LIRSCache) described in the LIRS paper

I don't see the point of mentioning implementation details in the
description.

Greetings,
Maxime.
M March 17, 2022, 9:06 p.m. UTC | #8
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +(define-public clojure-core-cache
> +  (package
> +    (name "clojure-core-cache")
> +    (version "1.0.225")
> +    (home-page "https://github.com/clojure/core.cache")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url home-page)
> +                    (commit (string-append "v" version))))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +                "1dr1ply7ffdbd6bv4gygzmc0wx3q7zwzaaa1p93s28jkfp28276l"))))

There does not appear to be anything 'suspicious' in the source code
and the hash checks out.

Greetings,
Maxime.
M March 17, 2022, 9:08 p.m. UTC | #9
Reily Siegel schreef op do 03-02-2022 om 19:24 [-0500]:
> +    (home-page "https://github.com/clojure/core.cache")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url home-page)

IIUC, home pages and the git repository location are considered
independent, that merely happen to sometimes coincide, so I'd move the
home-page downwards and copy the URL into the 'url' field.

Greetings,
Maxime.
diff mbox series

Patch

diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index c4524c2abb..d390feff3d 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -259,6 +259,61 @@  (define-public clojure-algo-monads
     (home-page "https://github.com/clojure/algo.monads")
     (license license:epl1.0)))
 
+(define-public clojure-core-cache
+  (package
+    (name "clojure-core-cache")
+    (version "1.0.225")
+    (home-page "https://github.com/clojure/core.cache")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url home-page)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1dr1ply7ffdbd6bv4gygzmc0wx3q7zwzaaa1p93s28jkfp28276l"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure")
+       #:test-dirs '("src/test/clojure")
+       #:doc-dirs '("doc")))
+    (propagated-inputs (list clojure-data-priority-map))
+    (synopsis "Caching library for Clojure implementing various cache strategies")
+    (description "@code{core.cache} is a Clojure contrib library providing the
+following features:
+
+An underlying CacheProtocol used as the base abstraction for implementing new
+synchronous caches
+
+A defcache macro for hooking your CacheProtocol implementations into the
+Clojure associative data capabilities.
+
+Implementations of some basic caching strategies
+
+First-in-first-out (FIFOCache)
+Least-recently-used (LRUCache)
+Least-used (LUCache -- sometimes called Least Frequently Used)
+Time-to-live (TTLCacheQ)
+Naive cache (BasicCache)
+Naive cache backed with soft references (SoftCache)
+
+Implementation of an efficient buffer replacement policy based on the low
+inter-reference recency set algorithm (LIRSCache) described in the LIRS paper
+
+Factory functions for each existing cache type
+
+Caches are generally immutable and should be used in conjunction with
+Clojure's state management, such as atom.  SoftCache is the exception here,
+built on top of mutable Java collections, but it can be treated as an
+immutable cache as well.
+
+The @code{clojure.core.cache} namespace contains the immutable caches
+themselves.  The @code{clojure.core.cache.wrapped} namespace contains the same
+API operating on caches wrapped in atoms, which is the \"normal\" use in the
+wild.")
+    (license license:epl1.0)))
+
 (define-public clojure-core-match
   (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
         (revision "1")) ; this is the 1st commit buildable with clojure 1.9