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

Flag parsing #3

Closed
3rd-Eden opened this issue Jan 30, 2013 · 1 comment
Closed

Flag parsing #3

3rd-Eden opened this issue Jan 30, 2013 · 1 comment

Comments

@3rd-Eden
Copy link
Owner

The parser doesn't support parsing of custom flags in VALUE responses from the server. We should expose and API that allows users to specify a custom flag parser.

Specification

The parser exposes an flag api which accepts 2 arguments

  1. a unsigned 16/32bit integer
  2. a parser function

The integer can be 16 or 32 bit, this depends on the memcached version people are running.
Memcached 1.2.0 and lower the flag is a 16-bit integer. In memcached 1.2.1 and higher the flag is a 32-bit integer. So it's up to the developer to select correct flag.

The parser function receives a Buffer instance and returns the parsed value immediately.

// This will parse the response
parser.flag(1, function (buffer) {
  return Number(buffer.toString());
});

TODO

  • Check if we should also supply a string representation of the buffer to the parser.
@3rd-Eden
Copy link
Owner Author

912cae6 adds documentation for this change and finalizes this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant