Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for incr/decr operations #1

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

jesse-lauro
Copy link

Please consider merging this branch. Basically added support for incr/decr operations.

joewilliams and others added 30 commits March 19, 2010 12:00
incr/2 implements the increment command for memcached, decr implements
the decrement command.

addcounter/1 uses a simple (non-CAS) set to initialized a counter set
at zero, which can then be fiddled with via incr/2 and decr/2. This
was necessary because merle functions mainly as a key/value store for
arbitrary erlang data instead of a general data-store, such as we want
for cacti purposes.

literal/1 allows the user to submit literal strings over the socket to
memcached. This should be used with extreme caution as memcached is
intolerant of malformed input, but it is useful for determining what
strings sent to memcached should look like and checking assumptions
about its behavior.

TODO: (optional) need a Check-And-Set version of addcounter so that
distributed applications can update the same value with incr/2 and
decr/2. This would save client code from having to try changing a
value and then making a separate call to initialize it if it does not
exist.
All three of the above functions now return more erlang-ish results,
in keeping with the rest of merle. addcounter/1 also uses incr/2 to
determine if a prospective key exists before creating it. This should
be replaced with a CAS-version in the future.
merle:literal/1 is rough and possibly dangerous to leave in production
code (why would we let random erlang clients submit arbitrary strings
to memcached?), so it is now compiled only when the DEV flag is
defined to erlc.

Added EDoc segments for addcounter/1, incr/2 and decr/2 have been added
* added incr and decr to listed features

* added note to the effect that counters aren't erlang terms

* demonstration of incr, decr and addcounter

* examples of delete with counters and incr/decr on counters that
  don't exist
merle is distributed under the MIT license, but doesn't seem to have
copy of the text of the MIT license with the code. With the addition
of LICENCE.txt, that little wrinkle should be cleared up.
…clustering to play nice with added support for increment operations
…rt more than just erlang binary term storage in order to support inc/dec operations
… merle process and let the merle_watcher restart it via the supervisor.
…gr dies, all outstanding merle watchers will also die
…merle_client itself. merle_pool merely chooses a client, which is then checked out via the exec function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants