Skip to content

Instantly share code, notes, and snippets.

View barkanido's full-sized avatar
🎯
Focusing on https://github.com/AppsFlyer/aerospike-clj

Ido Barkan barkanido

🎯
Focusing on https://github.com/AppsFlyer/aerospike-clj
View GitHub Profile
user=> (aero/put c "17" "set-name" 1 1000 {:transcoder str})
<< … >>
(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")
user=> @(aero/get-single c "index" "set-name")
#aerospike_clj.client.AerospikeRecord{:payload 42, :gen 1, :ttl 285167713}
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)
@barkanido
barkanido / aero-client.clj
Created January 23, 2019 04:26
create aerospike client
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=>