   (first (select event-extension-type
                  (where {:name (str (name type-name))}))))
 
+(def ^{:private true} cache-event-extra-data (cache/create-cache-region :event-extra-data 10000 (* 24 60 60 1000)))
+
 ;; TODO add caching
 (defn get-extension-type-by-name! [type-name]
   (util/try-times 1

        ]

    (if (not (empty? conditions))
      (let [results (select event
                            (where (apply and conditions))
                            (order (order-by 0) (order-by 1))
                            (limit result-limit)) ]

        (map (fn [event]
               (let [event-id (:id event)
                     extra-data (cache/lookup cache-event-extra-data event-id

  (:require [ruuvi-server.configuration :as conf]
            [ruuvi-server.util :as util]
            [clojure.string :as string]
            [ruuvi-server.cache :as cache]
            [clojure.java.jdbc :as sql]
            )
  (:use [korma.db :only (transaction)]
        [korma.core :only (select where insert update values
                                  set-fields with limit order fields)]
