Comments (9)
Yes, flags are a pretty useful feature. It's on the TODO (in README.md
) list but I never got around to it, thanks for the kick in the butt
from memjs.
Yeah, what am I paying you for? :-)
from memjs.
OK, I'm looking at doing this right now. The biggest question is where should the argument go such that I don't break people's existing code in some hard to debug way. The current signature for set
is:
set(key, value, callback, expires)
Where expires
was added at the end specifically for this reason. An obvious option is to stick flags
at the end again, but this starts to seem ugly (why isn't the callback last?). Two alternatives come to mind:
- Phase out the current interface and opt for a jQuery dictionary style argument to
set
et al. - Do the hack where we look at the type of the arguments and use that to simulate method overloading.
- Some combination of (1) and (2) where we support the legacy interface by looking at the types, but if the first parameter is a dictionary, use (1) instead.
Thoughts? Other suggestions?
from memjs.
You haven't reached 1.0 yet so breaking charges are still allowed. 1) seems the cleanest, but you can try 3) with a deprecation warning if a dictionary isn't used.
from memjs.
OK, I buy that. People are using it in production, nontheless, so I'd rather not totally break API, but 3 with a deprecation warning makes sense. Does a dictionary in fact seem like a decent API? In jQuery, for example, they use that API under the hood, but have higher level functions take regular arguments. I suspect because the dictionary can be cumbersome for sequencing callbacks...
from memjs.
And be aware that npm gets you new versions by default. Not everybody is disciplined enough to npm shrinkwrap and what not.
from memjs.
Most of the other libs I've used take a dict options = {some: 'some', dict: 'dict'}
for the initial setup, i.e., new winston.transports.File options
and sometimes have it as the first argument, i.e., request options callback
. Can you give an example of how callback sequencing gets cumbersome?
from memjs.
Ah, no that seems fine. At the moment newer arguments have been stuck on after the callback to maintain backwards-compatability. The way you are suggesting doesn't make chaining harder at all
from memjs.
Duplicate of #53
from memjs.
Related Issues (20)
- timeout but failed to retry until restarting program HOT 28
- Is it possible to use from the browser? HOT 1
- Operation timeouts do not work as expected HOT 3
- How to clear memcached server from nodejs? HOT 2
- Denial of Service vulnerability HOT 1
- memJS terminates connection to coherence HOT 1
- Feature: Key wrapper
- Get without callback returns incorrect signature HOT 2
- Possibility to get all errors from server
- Do we have option to use limit and offset HOT 1
- Application exits if memcached server restarts HOT 1
- Can we delete many keys? HOT 1
- unix socket support HOT 1
- MCRouter issue HOT 3
- Add node autodiscovery HOT 1
- TLS support for memjs
- Sporadic bursts of error: socket timed out waiting on response
- Trying an operation after calling `.quit()` doesn't trigger any errors HOT 3
- Possible bug in signature check HOT 2
- Possible support for ASCII protocol? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memjs.