strongh / crache Goto Github PK
View Code? Open in Web Editor NEWRedis-backed caching and memoization for clojure, following core.cache and core.memoize
Redis-backed caching and memoization for clojure, following core.cache and core.memoize
I can't install crache for the aforementioned reason.
Updating carmine to 2.19.1 fixes the issue for me, although I don't know what implications that might have...
I'm probably just missing something here, but why does lookup return a Delay? It's pretty frustrating to need to check delay? or force just for crache when other core.cache backends don't return Delays.
How would you apply memo-redis
for the fn of a library without changing the library in the following situation. I want to be able to memoize an fn I don't directly use in my app, but which is called by an fn I actually use.
I tried alter-var-root
to no avail. At least after restarting the app, the performance didn't increase with the redis saved memoization:
(alter-var-root (var f) (fn [f] (memo-redis f)))
Hello, when you have a chance, would you mind pushing a new snapshot? The most recent in Clojars is from 7760bf7. Thank you ๐
As a follow-up from #3 :
Depending on your application, you could consider having 2 layers of memoization; the local in-memory core.memoize, as well as the crache.memo for keys not in the first cache.
Crache will absolutely be slower than the core equivalents. It's performing serialization and deserialization, and possibly communicating over a network. Is your redis server co-located with your app?
Shouldn't deserialized data be ready to use when requested, rather than deserialized on demand? I think if it is deserialized on demand, it's a huge bottleneck.
The first optimization I'd consider is serialization. Currently (de)serialization is done by pr-str and read-string, which I doubt are terribly performant.
In fact it seems it is, but just a little :) so I was using nippy instead to replace pr-str
/read-string
, before deciding to use your redis backed memoization solution. nippy
didn't seem to correctly serialize/deserialize some unknown amount of data for a reason I cannot understand yet. But maybe that problem wont reproduce here. In their website they claim:
Clojure's rich data types are awesome. And its reader allows you to take your data just about anywhere. But the reader can be painfully slow when you've got a lot of data to crunch (like when you're serializing to a database).
Use case is online if you want to try it: http://kanasubs.com . Just insert a file and wait a little until it is converted.
I wanted to try something myself, but Clojars is down for SCP uploads since a vulnerability was found in bash.
I use your library like this:
(defn start-memo-redis []
(doseq [f [f1 f2 f3]]
(memo-redis f)))
(start-memo-redis)
But even with snapshotting configured, it doesn't save anything, So after I tried to list the client. In redis-cli
, I type client list
,
127.0.0.1:6379> client list
addr=127.0.0.1:57331 fd=6 name= age=2 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
but only the cli client is listed. Maybe I'm doing something wrong?
Using Redis 2.8.6.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.