   [request]
   (client/get (request :url) {:as :json-string-keys}))
 
-(defn- is-valid-endpoint
+(defn- is-valid-endpoint?
   [endpoint]
   (:address endpoint))
+
+(def endpoint?
+  (memoize (fn [endpoint] (is-valid-endpoint? endpoint))))
 
 (defn endpoint
   "Gets a client for a RavenDB endpoint at the

  ([endpoint index]
   (put-index endpoint index req/put-index res/put-index))
  ([endpoint index request-builder response-parser]
   {:pre [(is-valid-endpoint endpoint)
          (:name index) (:alias index) (:where index) (:select index)]}
   (let [request (req/put-index (:address endpoint) index)
         response (put-req request)]

  ([endpoint document-ids]
   (load-documents endpoint document-ids req/load-documents res/load-documents))
  ([endpoint document-ids request-builder response-parser]
   {:pre [(endpoint? endpoint) (not-empty document-ids)]}
   (let [request (request-builder (:address endpoint) document-ids)
         response (post-req request)]
     (response-parser response))))
