                 order " "
                 data-session-id " "
                 realtime " "
-                )))
-
-
-
-:else
-(do
-  (let [
-        record-count
-
-        (:cnt (sql-1 (str
-                        "select count (id) as CNT from "
-                        db-table " "
-                        (if (-> where count pos?) (str "where " where " "))
-                        )
-                       params))
+                ))
+  (println "************************************************************************************")
+
+  (cond
+       realtime
+       
+       (let [
+             query-key   (create-query-key
+                            :db-table db-table
+                            :where where
+                            :start start
+                            :end end
+                            :params params
+                            :order order)
+             ]
+
+           (if (get @cached-queries  query-key)
+               nil
+              (swap! cached-queries assoc  query-key {})
+           )
+
+          (println "-------------------------------")
+          (println cached-queries)
+          (println "-------------------------------")
+      )
+
+
+
+      :else
+
+      (do
+          (let [
+                 record-count      (get-count   db-table  where   params)
 
 
 

          :end end
          :params params
          :order order
         }
)



(defn !get-query-results-v2
  [{:keys [
           db-table
		       where
           start
           end
           params
           order
           realtime
           data-session-id
		   ]}]

  (println "************************************************************************************")
  (println "!get-query-results-v2*   REALTIME = " realtime)


(cond
   realtime
  (let [
  query-key   (create-query-key
                :db-table db-table
                :where where
                :start start
                :end end
                :params params
                :order order
  )
  ]
  (if (get @cached-queries  query-key)
    nil
    (swap! cached-queries assoc  query-key {})
  )
    (println "-------------------------------")
   (println cached-queries)
    (println "-------------------------------")
  
  

  (println (str "!get-query-results-v2: "
                db-table
                where " "







(defn create-query-key [& {:keys [
                                   db-table
                                   where
                                   start
                                   end
                                   params
                                   order
                                   ]}]
         {
          :db-table db-table
          :where where
