bonsaif 1.10.28 → 1.10.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -252,6 +252,31 @@ const smembers=async( options, db, key, toJson )=>{ // SMEMBERS key
252
252
  })
253
253
  }
254
254
 
255
+ const scard=async( options, db, key )=>{ // SCARD key
256
+ const exec = require("./exec");
257
+ const redisConn = await exec.redisConn(options);
258
+ const start = Date.now();
259
+ return new Promise((resolve, reject)=>{
260
+ try{
261
+ redisConn.select(db,function() { /* ... */ }); //base 1
262
+ redisConn.scard(key, function (err, res) {
263
+
264
+ const end = Date.now();
265
+ const time = end - start;
266
+
267
+ resolve({"scard":key, "err":err, "res":res, "time":utl.milisegundosASegundos(time)});
268
+ try{
269
+ exec.redisClose(redisConn);
270
+ }catch(e){
271
+ utl.log('err.scard '+e);
272
+ }
273
+ });
274
+ }catch(e){
275
+ utl.log('err scard'+e);
276
+ }
277
+ })
278
+ }
279
+
255
280
  const hset=async( options,db, key, values )=>{ // HSET key field value [ field value ...]
256
281
  const exec = require("./exec");
257
282
  const redisConn = await exec.redisConn(options);
@@ -763,6 +788,7 @@ module.exports ={
763
788
  sadd,
764
789
  srem,
765
790
  smembers,
791
+ scard,
766
792
  hset,
767
793
  hgetall,
768
794
  del,
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "name": "bonsaif",
16
16
  "description": "bonsaif is a library to connect to bonsaif apis",
17
- "version": "1.10.28",
17
+ "version": "1.10.29",
18
18
  "main": "index.js",
19
19
  "directories": {
20
20
  "lib": "lib"