-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for Compare And Swap (CAS) to get, getMulti, and set #9
Conversation
justjake
commented
Apr 12, 2021
•
edited
Loading
edited
- Some monkeying around with directory structure to make build output directory more coherent
- get and getMutli return CAS
- set, delete, etc take CAS option
}); | ||
} | ||
const logger = this.options.logger; | ||
|
||
// TODO: support flags, support version (CAS) | ||
this.incrSeq(); | ||
const expiration = makeExpiration((options || {}).expires || this.options.expires); | ||
const expiration = makeExpiration( | ||
(options || {}).expires || this.options.expires |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is on modern TS so we can do options?.expires now, forgot I think when I wrote this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO. I want to get to this in the next PR where I remove callbacks!
* If Value and Extras are of type Buffer, then return type WhenBuffer. Otherwise, | ||
* return type NotBuffer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mention that this is just for hacky tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not though?
src/memjs/memjs.ts
Outdated
export interface GetResult<Value = MaybeBuffer, Extras = MaybeBuffer> { | ||
value: Value; | ||
extras: Extras; | ||
cas: CASToken | undefined; | ||
} | ||
|
||
export type GetMultiResult< | ||
Keys extends string = string, | ||
Value = MaybeBuffer, | ||
Extras = MaybeBuffer | ||
> = { | ||
[K in Keys]: GetResult<Value, Extras>; | ||
}; | ||
|
||
class Client<Value = MaybeBuffer, Extras = MaybeBuffer> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is all this really for tests? I should suck it up and make them just be all buffers