Liking cljdoc? Tell your friends :D

com.github.gateless.clj-pool-party.core


-with-pool-writer-lockcljmacro

(-with-pool-writer-lock pool & body)

Executes 'body' in the context of a pool's writer lock.

Executes 'body' in the context of a pool's writer lock.
sourceraw docstring

borrow-objectclj

(borrow-object pool)

Acquires an object from the pool. Re-uses an available object if present but will call gen-fn if no objects are available but space remains in the pool.

Acquires an object from the pool. Re-uses an available object if present but will
call gen-fn if no objects are available but space remains in the pool.
sourceraw docstring

build-poolclj

(build-pool gen-fn max-size)
(build-pool gen-fn
            max-size
            {:keys [close-fn borrow-health-check-fn return-health-check-fn
                    wait-timeout-ms]})

Builds and returns an object pool Params: gen-fn - 0-arity function that produces an object for pooling when called. max-size - The maximum number of objects to hold in the pool Optional params: borrow-health-check-fn - Function which takes an instance of an object from the pool that is about to be borrowed and returns a truthy value iff it's suitable for use. Otherwise, the object is removed from the pool. Note this is only called when the pool attempts to provide an object that has already been used; it is not called when the pool generates a new object using gen-fn. gen-fn should always generate a 'healthy' object. How you fulfill that guarantee or handle situations where gen-fn fails to fulfill that guarantee is up to you. return-health-check-fn - Function which takes an instance of an object that is about to be returned to the pool and returns a truthy value iff it's suitable for use. Otherwise, the object is removed from the pool. close-fn - 1-arity function to call when closing / destroying an object in the pool wait-timeout-ms - The number of milliseconds to wait if the pool is at max capacity. An exception is thrown if this is exceeded.

Builds and returns an object pool
Params:
gen-fn - 0-arity function that produces an object for pooling when called.
max-size - The maximum number of objects to hold in the pool
Optional params:
borrow-health-check-fn - Function which takes an instance of an object from the pool that is about to
                         be borrowed and returns a truthy value iff it's suitable for use. Otherwise,
                         the object is removed from the pool. Note this is only called when the pool
                         attempts to provide an object that has already been used; it is not called
                         when the pool generates a new object using gen-fn. gen-fn should always
                         generate a 'healthy' object. How you fulfill that guarantee or handle situations
                         where gen-fn fails to fulfill that guarantee is up to you.
return-health-check-fn - Function which takes an instance of an object that is about to be returned
                         to the pool and returns a truthy value iff it's suitable for use. Otherwise,
                         the object is removed from the pool.
close-fn - 1-arity function to call when closing / destroying an object in the pool
wait-timeout-ms - The number of milliseconds to wait if the pool is at max capacity. An exception
                  is thrown if this is exceeded.
sourceraw docstring

evict-allclj

(evict-all pool)

Acquires all locks and then closes and evicts all objects from the pool.

Acquires all locks and then closes and evicts all objects from the pool.
sourceraw docstring

return-objectclj

(return-object pool idx)

Returns the object at key 'k' back to the pool.

Returns the object at key 'k' back to the pool.
sourceraw docstring

with-objectcljmacro

(with-object pool f)
(with-object pool obj & body)

Borrows an object from the pool, applies it to f, and returns the result.

Borrows an object from the pool, applies it to f, and returns the result.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close