                  (with event-location)
                  (with event-extension-value)
                  (where {:id event_id})))
+  )
+
+(def ^{:private true} cache-event-extra-data (cache/create-cache-region :event-extra-data 10000 (* 60 60 1000)))
+
+(defn- get-event-extra-data [event-id]
+    {:event_locations (select event-location
+                              (where {:event_id event-id}))
+     :event_extension_values (select event-extension-value
+                                     (fields :value)
+                                     (with event-extension-type (fields :name))
+                                     (where {:event_id event-id}))
+     }
   )
 
 (defn search-events 


    (if (not (empty? conditions))
      (let [results (select event
                            (with event-location)
                            (with event-extension-value (fields :value)
                                  (with event-extension-type (fields :name)))              
                            (where (apply and conditions))
                            (order (order-by 0) (order-by 1))
                            (limit result-limit)) ]
        results
        )
      '() )))


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