            [com.hazelcast.client HazelcastClient]
            [com.hazelcast.client.impl HazelcastClientProxy]
            [com.hazelcast.client.config ClientConfig]
-           [com.hazelcast.config Config GroupConfig]
+           [com.hazelcast.config Config GroupConfig
+                                 InMemoryFormat
+                                 EvictionConfig EvictionPolicy EvictionConfig$MaxSizePolicy
+                                 NearCacheConfig NearCachePreloaderConfig NearCacheConfig$LocalUpdatePolicy]
            [com.hazelcast.map.listener EntryAddedListener 
                                        EntryRemovedListener 
                                        EntryEvictedListener

   (.setGroupConfig config (GroupConfig. group-name
                                         group-password))))

(defn client-config [{:keys [hosts retry-ms retry-max group-name group-password]}]
  (let [config (ClientConfig.)
        groupConfig (GroupConfig. group-name group-password)]
    (doto config 
      (.getNetworkConfig)
      (.addAddress (into-array hosts))
      (.setConnectionAttemptPeriod retry-ms)
      (.setConnectionAttemptLimit retry-max))
      (.setGroupConfig config groupConfig)
    config))

(defn instance-active? [instance]
  (-> instance
      (.getLifecycleService)
      (.isRunning)))

(defonce 
  ;; "will only be used if no config is provided"
  default-client-config
  {:hosts ["127.0.0.1"]
   :retry-ms 5000
   :retry-max 720000
   :group-name "dev"
   :group-password "dev-pass"})                        ;; 720000 * 5000 = one hour

(defonce c-instance (atom nil))


              group-password (assoc :group-password "********"))))

(defn client-instance 
  ([] (client-instance {}))
  ([conf]
    (let [ci @c-instance]
      (if (and ci (instance-active? ci))
