npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sails-redis-lite

v0.1.1

Published

Light redis adapter for waterline. Develop for caching complecated model datas.

Downloads

6

Readme

image_squidhome@2x.png

Light Redis Sails/Waterline Adapter

A light Sails/Waterline adapter for Redis. May be used in a Sails app or anything using Waterline for the ORM.

Base on the sails-redis, remove the indexes and unique constraints, add expire time support.

I develop it for caching complicated models datas which has a lot of associations.

Install

Install is through NPM.

$ npm install sails-redis-lite

Configuration

The following connection configuration is available:

// default values inline
config: {
  port: 6379,
  host: 'localhost',
  password: null,
  database: null
};

Alternatively the URL notation for configuration can be used for configuration:

config {
  url: 'redis://h:[email protected]:6379'
}

// Equivalent to:
// config: {
//   port: 6379,
//   host: 'host.com'
//   password: 'abc123'
// }
// Other portions of the URL, including the 'username' 'h' are ignored

Note that if both the 'url' notation and the 'host', 'port' and / or 'password' notations are used, the non-url configuration options will take precedence.

With Sails

When using this library with sails add the config below to your config/connections.js file:

  
  redis: {
    adapter: "sails-redis-lite",
    port: 6379,
    host: 'localhost'
  }

And then you can make it the default by changing config/models.js to show:

  connection: 'redis',

Low-Level Configuration (for redis driver)

Configuration for the underlying Redis driver itself is located as an object under the options. The following options are available:

  • parser: which Redis protocol reply parser to use. Defaults to hiredis if that module is installed. This may also be set to javascript.
  • return_buffers: defaults to false. If set to true, then all replies will be sent to callbacks as node Buffer objects instead of JavaScript Strings.
  • detect_buffers: default to false. If set to true, then replies will be sent to callbacks as node Buffer objects if any of the input arguments to the original command were Buffer objects. This option lets you switch between Buffers and Strings on a per-command basis, whereas return_buffers applies to every command on a client.
  • socket_nodelay: defaults to true. Whether to call setNoDelay() on the TCP stream, which disables the Nagle algorithm on the underlying socket. Setting this option to false can result in additional throughput at the cost of more latency. Most applications will want this set to true.
  • no_ready_check: defaults to false. When a connection is established to the Redis server, the server might still be loading the database from disk. While loading, the server not respond to any commands. To work around this, node_redis has a "ready check" which sends the INFO command to the server. The response from the INFO command indicates whether the server is ready for more commands. When ready, node_redis emits a ready event. Setting no_ready_check to true will inhibit this check.
  • enable_offline_queue: defaults to true. By default, if there is no active connection to the redis server, commands are added to a queue and are executed once the connection has been established. Setting enable_offline_queue to false will disable this feature and the callback will be execute immediately with an error, or an error will be thrown if no callback is specified.
  • retry_max_delay: defaults to null. By default every time the client tries to connect and fails time before reconnection (delay) almost doubles. This delay normally grows infinitely, but setting retry_max_delay limits delay to maximum value, provided in milliseconds.
  • connect_timeout defaults to false. By default client will try reconnecting until connected. Setting connect_timeout limits total time for client to reconnect. Value is provided in milliseconds and is counted once the disconnect occured.
  • max_attempts defaults to null. By default client will try reconnecting until connected. Setting max_attempts limits total amount of reconnects.
  • auth_pass defaults to null. By default client will try connecting without auth. If set, client will run redis auth command on connect.

FAQ

See FAQ.md.

Contribute

See CONTRIBUTING.md.

MIT License

See LICENSE.md.