This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (require '[aerospike-clj.client :as aero]) | |
nil | |
user=> (def c (aero/init-simple-aerospike-client ["localhost"] "test")) | |
;; Starting aerospike clients for clusters localhost with username null | |
#'user/c | |
user=> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (aero/put c "index" "set-name" 42 1000) | |
<< … >> | |
user=> (def f (aero/get-single c "index" "set-name")) | |
#'user/f | |
user=> (d/chain (aero/get-single c "index" "set-name") | |
#_=> :ttl | |
#_=> aero/expiry-unix | |
#_=> #(java.time.Instant/ofEpochSecond %) | |
#_=> str | |
#_=> println) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> @(aero/get-single c "index" "set-name") | |
#aerospike_clj.client.AerospikeRecord{:payload 42, :gen 1, :ttl 285167713} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns af-common-rta-aerospike.core | |
(:require [aerospike-clj.client :as aero] | |
[statsd.metrics :as metrics] | |
[statsd.core :as statsd] | |
[manifold.deferred :as d])) | |
(defrecord DBMeter [] | |
client/ClientEvents | |
(on-success [_ op-name op-result _index op-start-time client] | |
(statsd/send-timing (metrics/format-statsd-metric (:cluster-name client) op-name "latency") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (aero/put c "17" "set-name" 1 1000 {:transcoder str}) | |
<< … >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (aero/put c "index" "set-name" 42 1000) | |
<< … >> | |
user=> (defn inc-transcoder [rec] (when rec | |
#_=> (update rec :payload inc))) | |
#'user/inc-transcoder | |
user=> (d/chain (aero/get-single c "index" "set-name" {:transcoder inc-transcoder}) | |
#_=> :payload | |
#_=> println) | |
<< … >> | |
43 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns toy-url-decoder.core | |
(:require [cemerick.url :as c-url] | |
[criterium.core :as crit]) | |
(:import [java.net URI URL] | |
[io.netty.handler.codec.http QueryStringDecoder] | |
[java.nio.charset Charset] | |
[org.apache.http.client.utils URLEncodedUtils] | |
[org.apache.http NameValuePair] | |
[java.util List Map Map$Entry])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.LocalDateTime; | |
import java.time.ZonedDateTime; | |
import java.time.ZoneId; | |
import java.time.format.DateTimeFormatter; | |
import java.time.format.DateTimeFormatterBuilder; | |
import java.time.temporal.ChronoField; | |
public class Main { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(match/match [a b] | |
[_ true] :first | |
[true false] :second | |
[_ false] :third) | |
(try | |
(cond | |
(= b true) :first | |
(= b false) (try | |
(cond |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn foo [a b] | |
(let [x (+ a b)] | |
x)) | |
(def result (foo 3 4)) | |
result |
OlderNewer