imported>Supportadmin |
imported>Supportadmin |
Строка 1: |
Строка 1: |
| beanstalkd client & worker daemon for node
| | За последние пару лет, а сейчас январь 2018, в JS появилось столько всего нового и это в стольких местах описано. Пора собрать в кучу весь поток сознания. |
| | ==Объявления переменных let и const == |
| | [https://learn.javascript.ru/let-const Теория] |
| | [https://jsperf.com/let-vs-var-performance/93 Тесты] |
|
| |
|
| [https://www.npmjs.org/package/fivebeans оригинал]
| | Вывод: никакого существенного изменения производительности не несут. Вопрос в обратной совместимости кода. |
| | |
| ==FiveBeansClient==
| |
| | |
| Heavily inspired by node-beanstalk-client, which is a perfectly usable client but somewhat dusty. I wanted more complete support of the beanstalkd protocol in a project written in plain javascript.
| |
| | |
| All client method names are the same case & spelling as the beanstalk text command, with hyphens replaced by underscore. The single exception is delete, which is renamed to destroy().
| |
| | |
| For complete details on the beanstalkd commands, see its protocol documentation.
| |
| | |
| ===Creating a client===
| |
| | |
| The client constructor takes two arguments:
| |
| | |
| *host: The address of the beanstalkd server. Defaults to 127.0.0.1.
| |
| *port: Port to connect to. Defaults to 11300.
| |
| | |
| The client emits three events that you should listen for: connect, error, and close.
| |
| | |
| The client is not usable until you call its connect() method. Here's an example of setting up a client:
| |
| | |
| <nowiki>var fivebeans = require('fivebeans');
| |
| | |
| var client = new fivebeans.client('10.0.1.1', 11300);
| |
| client
| |
| .on('connect', function()
| |
| {
| |
| // client can now be used
| |
| })
| |
| .on('error', function(err)
| |
| {
| |
| // connection failure
| |
| })
| |
| .on('close', function()
| |
| {
| |
| // underlying connection has closed
| |
| })
| |
| .connect();</nowiki>
| |
| | |
| ===Producing jobs===
| |
| ===Consuming jobs===
| |
| ===Server statistics===
| |
| ==FiveBeansWorker==
| |
| ===API===
| |
| ====constructor====
| |
| ===Events===
| |
| ===Jobs===
| |
| ===Handlers===
| |
| ===Example===
| |
| ==FiveBeansRunner==
| |
| ===bin/beanworker===
| |
| ===Configuration file===
| |
За последние пару лет, а сейчас январь 2018, в JS появилось столько всего нового и это в стольких местах описано. Пора собрать в кучу весь поток сознания.
Объявления переменных let и const
Теория
Тесты
Вывод: никакого существенного изменения производительности не несут. Вопрос в обратной совместимости кода.