starling-0.3.0: A memcached client



All of the craziness for thread-safety and asynchronous operations lives here.

The idea is that if someone comes up with a better way of managing connection state they can build what they want on top of the Core module.

Operations are not entirely asynch - they block until a response is returned.

But we don't hold the connection lock while we're blocking, so other threads can still put requests on the connection.

This should work well where each thread needs one request to do it's job.

If you have a good idea for what an asynchronous API should look like let me know. It shouldn't be too hard to add on to what's already here.



data Connection Source

For thread safety of operations, we perform all requests on a wrapper around a handle.

open :: Handle -> IO ConnectionSource

Create a connection. Please don't use the handle after opening a connection with it.

close :: Connection -> IO ()Source

Shut down the connection. Non-blocking.

synchRequest :: Connection -> Request -> IO ResponseSource

Place a synchronous request which only returns one reply

synchRequestMulti :: Connection -> Request -> IO [Response]Source

Place a synchronous request which may return multiple response (Stat, pretty much)

ignorantRequest :: Connection -> Request -> IO ()Source

This function ignores anything coming back from the server. Non-blocking.