Can I connect Redis directly in JavaScript? [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
开发者_JAVA百科 Improve this questionBrowsing official available clients for Redis (https://redis.io/clients) it seems that there is no current client for JavaScript/TypeScript client library.
Am I right?
Is such a client simply missing or there is a reason why it cannot/should not exist?
There's a Redis binding for Node.js on Github:
http://github.com/fictorial/redis-node-client
and you can try node.js without any need for persistence.
If you have questions, right now it's best to show up on Freenode #node.js or the mailing list on Google Groups.
Unfortunately javascript can only communicate via HTTP or Websockets.
Here's an idea:
Embed a .swf in your page and write javascript callbacks for an actionscript redis client. https://github.com/claus/as3redis
This would have less network overhead than implementing something like http://webd.is/ or any other server-side redis client.
You should be reducing network overhead everywhere possible. While the following may be fast, we may still be able to do better.
step 1 ajax call -> php -> redis
step 2 redis -> php -> ajax return
....that's at least two separate tcp connections if your redis server is not on the same server as your backend application.
Why not cut out the middle-man and write javascript callbacks to actionscript redis calls?
Here's why: -You may not want to expose your redis server to the internet. -A client-side dependency on flash for your data retrieval may not be the best solution in terms of robustness.
I'd like to code this up someday and see how it performs. Let me know if you try it out!
I see http://github.com/fictorial/redis-node-client has been abandoned, rather use this http://github.com/mranney/node_redis, it's got good documentation, if combined with the redis commands http://redis.io/commands.
精彩评论