redis-manager-utils
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -19,8 +19,8 @@ const REDIS = require("redis"); | ||
} | ||
this.redis = undefined; | ||
this.redis = undefined; | ||
} | ||
async init() { | ||
this.redis = await REDIS.createClient( { | ||
this.redis = await REDIS.createClient( { | ||
host: this.host , | ||
@@ -47,3 +47,3 @@ port: this.port , | ||
} | ||
} ); | ||
} ); | ||
} | ||
@@ -77,3 +77,3 @@ | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -142,3 +142,3 @@ | ||
else { resolve(); } | ||
}); | ||
}); | ||
} | ||
@@ -152,3 +152,3 @@ | ||
catch( error ) { console.log( error ); resolve( "error" ); } | ||
}); | ||
}); | ||
} | ||
@@ -162,4 +162,4 @@ | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
} | ||
}); | ||
} | ||
@@ -181,3 +181,3 @@ increment( wKey ) { | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -188,3 +188,3 @@ | ||
if ( !wKey ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -219,7 +219,7 @@ try { that.redis.lrange( wKey , 0 , -1 , function( err , values ) { resolve( values ); }); } | ||
if ( !wIndex ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
try { that.redis.lindex( wKey , wIndex , function( err , key ) { resolve( key ); }); } | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -230,3 +230,3 @@ | ||
if ( !wArray ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -241,3 +241,3 @@ try { that.redis.rpush.apply( that.redis , [ wKey ].concat( wArray ).concat( function( err , keys ){ resolve( keys ); })); } | ||
if ( !wArray ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -261,3 +261,3 @@ try { that.redis.lpush.apply( that.redis , [ wKey ].concat( wArray ).concat( function( err , keys ){ resolve( keys ); })); } | ||
if ( !wValue ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -285,3 +285,3 @@ try { that.redis.rpush( wKey , wValue , function( err , values ) { resolve( values ); }); } | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -292,3 +292,3 @@ | ||
if ( !wValue ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -299,3 +299,3 @@ if ( !wValue ) { resolve(); return; } | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -310,3 +310,3 @@ | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -321,3 +321,3 @@ | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -332,3 +332,3 @@ | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -350,3 +350,3 @@ | ||
if ( !wArray ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -366,3 +366,3 @@ try { that.redis.sadd.apply( that.redis , [ wKey ].concat( wArray ).concat( function( err , keys ){ resolve( keys ); })); } | ||
catch( error ) { console.log( error ); reject( error ); } | ||
}); | ||
}); | ||
} | ||
@@ -393,3 +393,3 @@ | ||
if ( !wKey ) { return undefined; } | ||
let that = this; | ||
let that = this; | ||
return new Promise( function( resolve , reject ) { | ||
@@ -399,3 +399,3 @@ try { that.redis.hgetall( wKey , function( err , values ) { resolve( values ); }); } | ||
}); | ||
} | ||
} | ||
@@ -411,7 +411,7 @@ // Extras | ||
del_keys = del_keys.filter( Boolean ); | ||
if ( del_keys ) { | ||
if ( del_keys.length > 0 ) { | ||
//console.log( "\nRedis-Manager-Utils --> deleteing these keys --> \n" ); | ||
//console.log( del_keys ); | ||
//console.log( del_keys ); | ||
del_keys = del_keys.map( x => [ "del" , x ] ); | ||
@@ -444,5 +444,5 @@ await that.keySetMulti( del_keys ); | ||
let previous_index = await that.keyGet( wKey + ".INDEX" ); | ||
if ( !previous_index ) { previous_index = ( circle_length - 1 ); } | ||
console.log( "previousInCircularList() --> Starting Index === " + previous_index.toString() ); | ||
if ( !previous_index ) { previous_index = ( circle_length - 1 ); } | ||
else { | ||
else { | ||
previous_index = ( parseInt( previous_index ) - 1 ); | ||
@@ -479,5 +479,5 @@ await that.decrement( wKey + ".INDEX" ); | ||
let next_index = await that.keyGet( wKey + ".INDEX" ); | ||
if ( !next_index ) { next_index = 0; } | ||
console.log( "nextInCircularList() --> Starting Index === " + next_index.toString() ); | ||
if ( !next_index ) { next_index = 0; } | ||
else { | ||
else { | ||
next_index = ( parseInt( next_index ) + 1 ); | ||
@@ -540,3 +540,3 @@ await that.increment( wKey + ".INDEX" ); | ||
}); | ||
} | ||
} | ||
@@ -543,0 +543,0 @@ } |
{ | ||
"name": "redis-manager-utils", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "", | ||
@@ -14,3 +14,3 @@ "main": "main.js", | ||
}, | ||
"url": "https://github.com/ceberous/redis-manager", | ||
"url": "https://github.com/ceberous/redis-manager", | ||
"license": "ISC", | ||
@@ -17,0 +17,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19124