This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-17
Channels
- # announcements (2)
- # asami (3)
- # babashka (30)
- # beginners (23)
- # calva (28)
- # cider (3)
- # clj-kondo (16)
- # clj-on-windows (7)
- # cljs-dev (7)
- # clojure (47)
- # clojure-austin (3)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-greece (1)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (54)
- # community-development (24)
- # conjure (16)
- # duct (1)
- # emacs (8)
- # events (1)
- # figwheel-main (4)
- # fulcro (13)
- # gratitude (20)
- # helix (3)
- # honeysql (8)
- # hyperfiddle (12)
- # introduce-yourself (1)
- # jobs (6)
- # lambdaisland (1)
- # lsp (35)
- # malli (1)
- # meander (27)
- # minecraft (11)
- # off-topic (12)
- # pathom (1)
- # portal (11)
- # releases (1)
- # remote-jobs (1)
- # ring (11)
- # sci (1)
- # shadow-cljs (53)
- # specter (5)
- # xtdb (20)
Hi everyone! I have a quick question.
Is it possible to access the contents of ring.middleware.session.memory/memory-store
without passing a predefined atom?
I know I can access the data if I define an atom and pass that as argument to memory-store. If I don't then the function creates an unnamed atom, how do I access the unnamed atom?
It only returns the following without me being able to access it.
#object
[ring.middleware.session.memory.MemoryStore 0x1295a8d0
"ring.middleware.session.memory.MemoryStore@1295a8d0"]
What I want to do in the end is get the ips that are logged in and the session count per ip.
Is that information going to be available in your session? I feel like you should use a separate mechanism for getting these stats. But you could use something like this as a workaround:
(comment
(def ms (memory-store))
(.write-session ms "k" "val")
(.read-session ms "k")
(.write-session ms "k2" "val2")
(.session_map ms)
;; => #atom[{"k" "val", "k2" "val2"} 0x7f51bf9]
.)
Of course, this relies on an implementation detail 🙂
I just used cider-inspect
in emacs to look at the contents of ms
var.