BSD-3-Clause licensed and maintained by David Terei
This version can be pinned in stack with:memcache-0.3.0.2@sha256:438e0792f70cca705d93bd609eb2ff065a25a53f83be3521adfbe1b44d7dabb7,3779

memcache: Haskell Memcached Client

Hackage Hackage Dependencies BSD3 License Build Gitter

A client library for a memcached cluster.

It supports the binary memcached protocol and SASL authentication. No support for the ASCII protocol is provided. It supports connecting to a single, or a cluster of memcached servers. When connecting to a cluser, consistent hashing is used for routing requests to the appropriate server.

Complete coverage of the memcached protocol is provided except for multi-get and other pipelined operations.

Licensing

This library is BSD-licensed.

Tools

This library also includes a few tools for manipulating and experimenting with memcached servers.

  • OpGen – A load generator for memcached. Doesn’t collect timing statistics, other tools like mutilate already do that very well. This tool is useful in conjunction with mutilate.
  • Loader – A tool to load random data of a certain size into a memcached server. Useful for priming a server for testing.

Architecture Notes

We’re relying on Data.Pool for thread safety right now, which is fine but is a blocking API in that when we grab a socket (withResource) we are blocking any other requests being sent over that connection until we get a response. That is, we can’t pipeline.

Now, use of multiple connections through the pool abstraction is an easy way to solve this and perhaps the right approach. But, could also implement own pool abstraction that allowed pipelining. This wouldn’t be a pool abstraction so much as just round-robbining over multiple connections for performance.

Either way, a pool is fine for now.

Other clients

Get involved!

We are happy to receive bug reports, fixes, documentation enhancements, and other improvements.

Please report bugs via the github issue tracker.

Master git repository:

  • git clone https://github.com/dterei/memcache-hs.git

Authors

This library is written and maintained by David Terei ([email protected]).

Contributions have been made by the following great people:

Changes

0.3.0.2 - March 27th, 2024

  • Make the key hashing algorithm configurable by clients – that is, let clients provide a function mapping a key to a server.

0.3.0.1 - January 17th, 2021

  • No changes, needed a new release to fix a Hackage upload issue.

0.3.0.0 - January 17th, 2021

  • Bump package dependencies for newer GHC/back/network.
  • Update code to work with newer dependencies.

0.2.0.1 - November 2nd, 2016

  • Fix compatability with latest data-default-class
  • Add new ReqRaw type for external clients to implement custom requests. Quite a hack right now, so behind a WARNING pragma.

0.2.0.0 - May 27th, 2016

  • Big design change to reduce code duplication (Protocol module gone).
  • Remove Options type - just fixed configuration for now.
  • Design change also allows proper retry handling on operation failure - we retry an operation against the same server, but after N consecutive failures, we mark the server as dead and don’t try using it again until M seconds has passed.
  • Simplify exception hierachy - just one type MemcacheError now for
  • Remove defaultOptions and defaultServerSpec, will revist usefulness. exceptions.
  • Remove many Typeable instances.
  • Support better testing with a mock Memcached server.
  • Fix bug in socket handling - detected EOF properly.
  • Greatly improve documentation.
  • Use data-default-class for defaults of servers and options.

0.1.0.1 - February 26th, 2016

  • Consistent usage of ‘memcached’ instead of ‘memcache’.
  • Document Database.Memcache.Client.
  • Add inline pragmas in appropriate places.
  • Fix bug handling fragmented IP packets (Alfredo Di Napoli).

0.1.0.0 - May 18th, 2015

  • First proper release (although still lots of rough edges!).
  • Filled out Data.Memcache.Client to a complete API.
  • Integrated cluster and authentication handling.
  • Better error and exception handling.
  • Fix compilation under GHC 7.10.

0.0.1 - May 5th, 2015

  • Initial (incomplete) support for a cluster of memcached servers.
  • Fixed compilation under GHC 7.4.

0.0.0 - August 23rd, 2013

  • Initial release. Support for a single server.