Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
A high-level Redis library.
$ npm install redback
Redback provides an accessible and extensible interface to the Redis data types and allows you to create your own structures with ease. Redback comes with the following built-in structures: List, Set, SortedSet, Hash, Channel, Cache
It also comes with the following advanced data structures:
var redback = require('redback').createClient();
// or
var redis = require('redis').createClient();
var redback = require('redback').use(redis);
var user3 = redback.createSocialGraph(3);
user3.follow(1, callback);
var log = redback.createCappedList('log', 1000);
log.push('Log message ...');
var user = redback.createHash('user1');
user.set({username: 'chris', password: 'foobar'}, callback);
Use addStructure(name, methods)
to create your own structure.
Let's create a queue that can be either FIFO or LIFO:
redback.addStructure('SimpleQueue', {
init: function (options) {
options = options || {};
this.fifo = options.fifo;
},
add: function (value, callback) {
this.client.lpush(this.key, value, callback);
},
next: function (callback) {
var method = this.fifo ? 'rpop' : 'lpop';
this.client[method](this.key, callback);
}
});
Call createSimpleQueue(key, options)
to use the queue:
var queue = redback.createSimpleQueue('my_queue', {fifo: true});
queue.add('awesome!');
Structures have access to a Redis key this.key
and the Redis client
this.client
. If an init()
method is defined then it is called after
the structure is instantiated. Also note that init()
receives any extra parameters
from create<structure>()
.
Cache backend
var cache = redback.createCache(namespace);
cache.set('foo', 'bar', callback);
cache.get('foo', function (err, foo) {
console.log(foo); //bar
});
Pub/sub provider
var channel = redback.createChannel('chat').subscribe();
//To received messages
channel.on('message', function (msg) {
console.log(msg);
});
//To send messages
channel.publish(msg);
See the annotated source.
The tests require a local redis instance running on localhost:6379
. Note that
redis database #11 will be flushed prior to each run.
$ npm test
MIT
FAQs
A high-level Redis library
The npm package redback receives a total of 84 weekly downloads. As such, redback popularity was classified as not popular.
We found that redback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.