clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
mbarillier 2021-06-30T00:24:18.211500Z

I'm looking for a clojure library that implements a disk-backed LRU cache -- any suggestions? I'm reading many millions of records from a database and need to manipulate/mangle them and I'm running out of memory in the jvm process. (option B is mucking around with jvm memory settings, but if there's a clojure-friendly caching solution available I'm guessing it might be the more scalable and potentially simpler solution.)

2021-06-30T07:52:46.218200Z

https://github.com/ben-manes/caffeine Very well designed library.

Adrian Smith 2021-06-30T11:10:11.218700Z

What kind of manipulation are we talking about?

jcsims 2021-06-30T15:18:18.227100Z

Are you able to deterministically paginate your queries from the database? Not sure what kind of mangling you're doing (e.g. if all that data is required to be in memory/cache at once)

markaddleman 2021-06-30T00:25:36.212400Z

Not a cache directly but Chronicle Map might be helpful: https://github.com/OpenHFT/Chronicle-Map

mbarillier 2021-06-30T00:25:45.212800Z

(btw, was looking at org.clojure/cache.core -- did I overlook an implementation in that lib that reads from/writes to disk?)

mbarillier 2021-06-30T00:27:29.213Z

looks like it has potential, will look through the readme a bit. thanks!

seancorfield 2021-06-30T00:28:21.213200Z

core.cache is all in-memory.

mbarillier 2021-06-30T00:29:16.213400Z

rats, thought so. thanks for confirming.

2021-06-30T01:31:36.214800Z

Cloned your vs code / clover github - love it! (had to make the code font smaller though 😀)

seancorfield 2021-06-30T02:43:24.215Z

Haha... I did that partly for doing screen shares... And partly because I'm old and my eyes are going 👀

🙃 1
2021-06-30T03:28:23.215200Z

So many

Dominic Pearson 2021-06-30T13:30:41.225200Z

I have a question about java interop. Do typecasts happen automatically? Am trying to understand how it is handled under the hood. Say, char-array, which calls (. clojure.lang.Numbers char_array size init-val-or-seq) and thus maps to static public char[] char_array(int size, Object init){ in Numbers.java. One can pass a Long as the size, but the signature for this method expects an int, which > Integer/MAX_VALUE results in an overflow. Do all interop calls attempt to coerce the inputs?

Dominic Pearson 2021-06-30T13:34:00.225300Z

(This is just a followup on a nasty bug I encountered, where I was using arbitrarily-sized byte-arrays to store temporary data, and did not know that JVM arrays were int-indexed. I am wondering if this behaviour is general with interop. Also where is the best place to put a note or warning about such things. I don't have commit access, but it might be useful for int-indexed to be referenced in the docstring at least. Not sure who to ask about this sort of thing.)

alexmiller 2021-06-30T13:40:46.225500Z

The best place to ask questions like this is at https://ask.clojure.org

alexmiller 2021-06-30T13:41:35.225800Z

in general, most Java things are int-indexed (arrays and collections) and Clojure defaults to longs for integer values

alexmiller 2021-06-30T13:42:25.226Z

most people don't have more than max int number of things in either of those, so this difference is not obvious

alexmiller 2021-06-30T13:44:59.226300Z

the situation with arity/type matching/casting is complicated, some info at https://clojure.org/reference/java_interop, https://clojure.org/reference/reader#_literals

Dominic Pearson 2021-06-30T13:50:34.226500Z

Thanks. I'll read more there.

2021-06-30T23:36:29.232500Z

What's that Clojure talk where Rich discusses semver and how any API or breaking changes should be a separate file, function, or library?

2021-06-30T23:37:10.232800Z

something with speculation in the title maybe

alexmiller 2021-06-30T23:37:28.233Z

Spec-ulation

alexmiller 2021-06-30T23:37:40.233200Z

https://www.youtube.com/watch?v=oyLBGkS5ICk

2021-06-30T23:44:31.233400Z

Thanks!