taoensso / carmine

Redis client + message queue for Clojure
https://www.taoensso.com/carmine
Eclipse Public License 1.0
1.16k stars 131 forks source link

Custom serializer #145

Closed alolis closed 8 years ago

alolis commented 8 years ago

Hello,

I am trying to figure out how to add custom a custom serializer for a specific data type I am using. I am aware that this is possible with nippy, but how do I combine this functionality with carmine?

I did try to include nippy in my project dependencies and created a custom type with extend-thaw and extend-freeze as per nippy instructions, and when I run it with lein run I get the following compilation error:

java.lang.Exception: namespace 'taoensso.timbre' not found, compiling:(taoensso/carmine.clj:1:1)
Exception in thread "main" java.lang.Exception: namespace 'taoensso.timbre' not found, compiling:(taoensso/carmine.clj:1:1)

I also tried to include timbre in my project dependencies; no luck. I am using latest version from all libraries with clojure 1.6.0

Any idea what am I doing wrong?

alolis commented 8 years ago

Never mind, it was a mistake on my side with project dependencies. All good :)

ptaoussanis commented 8 years ago

Hey Alexander,

You've got the right idea! Carmine uses Nippy for serialization, so you just need to extend Nippy to your custom data type and it should just work with Carmine as you'd expect.

I did try to include nippy in my project dependencies

You can, but shouldn't even be necessary. If you have Carmine as a dependency, it'll pull in an appropriate version of Nippy automatically. If you don't care about the details, I'd let Carmine choose the dep it wants.

extend-thaw and extend-freeze

Correct! That should just work.

I get the following compilation error:

Hmm, not sure - but that definitely doesn't look like anything to do with the custom data type. Have you tried lein deps :tree to check your project deps?

ptaoussanis commented 8 years ago

Race condition, happy you got it sorted :-)

alolis commented 8 years ago

@ptaoussanis , thanks for getting back to me, it seems that we posted the same time :)