Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Sep 30, 2015
2 parents 2c2624c + fb9331a commit c0de008
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 43 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
@@ -1,19 +1,20 @@
> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**.
## v2.12.0-beta1 / 2015 Aug 31
## v2.12.0 / 2015 Sep 30

> This is a significant **feature release** focused on new CAS utils
* **New**: conn spec URIs now support /db path [#113 @olek]
* **New**: `with-replies` now supports nesting
* **New**: added experimental CAS utils: `swap`, `hswap`
* **New**: updated commands.json (2015 Aug 5)
* **Perf**: bumped Nippy dependency to v2.10.0
* **Perf**: minor low-level Redis protocol optimizations
* **Fix**: Tundra S3 datastore wasn't closing input stream
* **Docs**: `wcar` docstring now has a warning re: laziness [#138]

```clojure
[com.taoensso/carmine "2.12.0-beta1"]
[com.taoensso/carmine "2.12.0"]
```


Expand Down
7 changes: 3 additions & 4 deletions README.md
@@ -1,8 +1,7 @@
**[API docs][]** | **[CHANGELOG][]** | [other Clojure libs][] | [Twitter][] | [contact/contrib](#contact--contributing) | current [Break Version][]:

```clojure
[com.taoensso/carmine "2.11.1"] ; Stable
[com.taoensso/carmine "2.12.0-beta1"] ; Dev, see CHANGELOG for details
[com.taoensso/carmine "2.12.0"] ; See CHANGELOG for details
```

# Carmine, a Clojure Redis client & message queue
Expand Down Expand Up @@ -41,7 +40,7 @@ Carmine is an attempt to **cohesively bring together the best bits from each cli
Add the necessary dependency to your [Leiningen][] `project.clj` and `require` the library in your ns:

```clojure
[com.taoensso/carmine "2.11.1"] ; project.clj
[com.taoensso/carmine "2.12.0"] ; project.clj
(ns my-app (:require [taoensso.carmine :as car :refer (wcar)])) ; ns
```

Expand Down Expand Up @@ -370,7 +369,7 @@ Otherwise reach me (Peter Taoussanis) at [taoensso.com][] or on [Twitter][]. Che

## License

Copyright © 2012-2014 Peter Taoussanis. Distributed under the [Eclipse Public License][], the same as Clojure.
Copyright © 2012-2015 Peter Taoussanis. Distributed under the [Eclipse Public License][], the same as Clojure.


[API docs]: http://ptaoussanis.github.io/carmine/
Expand Down
15 changes: 7 additions & 8 deletions project.clj
@@ -1,4 +1,4 @@
(defproject com.taoensso/carmine "2.12.0-beta1"
(defproject com.taoensso/carmine "2.12.0"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Clojure Redis client & message queue"
:url "https://github.com/ptaoussanis/carmine"
Expand All @@ -12,9 +12,9 @@

:dependencies
[[org.clojure/clojure "1.5.1"]
[com.taoensso/encore "2.5.0"]
[com.taoensso/timbre "4.1.1"]
[com.taoensso/nippy "2.9.0"]
[com.taoensso/encore "2.19.0"]
[com.taoensso/timbre "4.1.4"]
[com.taoensso/nippy "2.10.0"]
[org.apache.commons/commons-pool2 "2.4.2"]
[commons-codec/commons-codec "1.10"]
[org.clojure/data.json "0.2.6"]]
Expand All @@ -26,8 +26,8 @@
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:test {:dependencies [[expectations "2.1.0"]
[org.clojure/test.check "0.7.0"]
[com.taoensso/faraday "1.7.1"]
[org.clojure/test.check "0.8.2"]
[com.taoensso/faraday "1.8.0"]
[clj-aws-s3 "0.3.10"]
[ring/ring-core "1.4.0"]]
:plugins [[lein-expectations "0.0.8"]
Expand All @@ -40,8 +40,7 @@
:test-paths ["test" "src"]

:aliases
{"test-all" ["with-profile" "default:+1.5:+1.6:+1.7" "expectations"]
;; "test-all" ["with-profile" "default:+1.6" "expectations"]
{"test-all" ["with-profile" "+1.5:+1.6:+1.7" "expectations"]
"test-auto" ["with-profile" "+test" "autoexpect"]
"deploy-lib" ["do" "deploy" "clojars," "install"]
"start-dev" ["with-profile" "+server-jvm" "repl" ":headless"]}
Expand Down
49 changes: 20 additions & 29 deletions src/taoensso/carmine.clj
@@ -1,5 +1,5 @@
(ns taoensso.carmine "Clojure Redis client & message queue."
{:author "Peter Taoussanis"}
{:author "Peter Taoussanis (@ptaoussanis)"}
(:refer-clojure :exclude [time get set key keys type sync sort eval])
(:require [clojure.string :as str]
[taoensso.encore :as encore]
Expand All @@ -10,17 +10,9 @@
(connections :as conns)
(commands :as commands)]))

;;;; Encore version check

(let [min-encore-version 1.28] ; For `backport-run!` support
(if-let [assert! (ns-resolve 'taoensso.encore 'assert-min-encore-version)]
(assert! min-encore-version)
(throw
(ex-info
(format
"Insufficient com.taoensso/encore version (< %s). You may have a Leiningen dependency conflict (see http://goo.gl/qBbLvC for solution)."
min-encore-version)
{:min-version min-encore-version}))))
(if (vector? taoensso.encore/encore-version)
(encore/assert-min-encore-version [2 11 0])
(encore/assert-min-encore-version 2.11))

;;;; Connections

Expand Down Expand Up @@ -88,29 +80,28 @@

;;;; Misc core

(encore/defalias as-bool encore/as-?bool)
(encore/defalias as-int encore/as-?int)
(encore/defalias as-float encore/as-?float)
(encore/defalias as-map encore/as-map)
;;; Mostly deprecated; prefer using encore stuff directly
(defn as-int [x] (when x (encore/as-int x)))
(defn as-float [x] (when x (encore/as-float x)))
(defn as-bool [x] (when x (encore/as-bool x)))
(defn as-map [x] (encore/as-map x))

(encore/defalias parse protocol/parse)
(encore/defalias parser-comp protocol/parser-comp)

;;; Note that 'parse' has different meanings in Carmine/Encore context:
(defmacro parse-int [& body] `(parse as-int ~@body))
(defmacro parse-float [& body] `(parse as-float ~@body))
(defmacro parse-bool [& body] `(parse as-bool ~@body))
(defmacro parse-keyword [& body] `(parse keyword ~@body))

(defmacro parse-suppress "Experimental." [& body]
`(parse (fn [_#] protocol/suppressed-reply-kw) ~@body))

(comment (wcar {} (parse-suppress (ping)) (ping) (ping)))

(encore/defalias parse-raw protocol/parse-raw)
(encore/defalias parse-nippy protocol/parse-nippy)

(defmacro parse-int [& body] `(parse as-int ~@body))
(defmacro parse-float [& body] `(parse as-float ~@body))
(defmacro parse-bool [& body] `(parse as-bool ~@body))
(defmacro parse-keyword [& body] `(parse keyword ~@body))
(defmacro parse-suppress [& body]
`(parse (fn [_#] protocol/suppressed-reply-kw) ~@body))

(defmacro parse-map [form & [kf vf]] `(parse #(encore/as-map % ~kf ~vf) ~form))

(comment (wcar {} (parse-suppress (ping)) (ping) (ping)))

(defn key
"Joins parts to form an idiomatic compound Redis key name. Suggested style:
* \"category:subcategory:id:field\" basic form.
Expand Down Expand Up @@ -630,7 +621,7 @@
;;;; Deprecated

(def as-long "DEPRECATED: Use `as-int` instead." as-int)
(def as-double "DEPRECATED: Use `as-float` instead." as-double)
(def as-double "DEPRECATED: Use `as-float` instead." as-float)
(defmacro parse-long "DEPRECATED: Use `parse-int` instead."
[& body] `(parse as-long ~@body))
(defmacro parse-double "DEPRECATED: Use `parse-float` instead."
Expand Down
2 changes: 2 additions & 0 deletions src/taoensso/carmine/message_queue.clj
Expand Up @@ -23,6 +23,8 @@
[taoensso.carmine :as car :refer (wcar)]
[taoensso.encore :as encore]))

;; TODO Ability to enqueue something with an init backoff

;;;; Ideas to avoid polling
;; 1. Lua brpoplpush - doesn't currently exist, unlikely to in future.
;; 2. Redis 2.8+ Pub/Sub keyspace notifications? Maybe with reliable Pub/Sub?
Expand Down

0 comments on commit c0de008

Please sign in to comment.