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

@ksfks/easy-kedis

v1.0.3

Published

让kedis使用起来更简单一些

Downloads

1

Readme

easy-kedis模块

为什么要开发这个模块?

主要是为了方便使用,主要是以下几个点

  • 批量查询 保证顺序
  • 批量查询 可以传入处理函数精简返回结果
  • 批量查询 数组长度过大会自动分组查询(主要原因是因为批量查询数据过多Kedis返回速度很慢)
  • 比较好的文档

常用API

getString

根据key查询value

  • keyItem {String} key的值

getStringBatch

批量查询

  • keyItems {Array<String>} keyItems key值数组
  • callback = null {Function} 可以传入处理函数精简返回结果

getStringWithVer

获取字符和版本

  • keyItem {String} key的值

setString

设置key-value

  • keyItem {String} key的值

setStringBatch

批量设置key-value

  • keyValueObject {Object} 键值对象

setStringEx

设置key-value, 指定超时

  • keyItem {String} 键名
  • value {String} 值
  • ver {Number} 版本号, 版本号需要用getStringWithVer先获取
  • dirty {Boolean} 是否脏数据
  • expireTimeSecond {Number} 超时时间秒 , eq: 缓存十分钟 (Date.now() / 1000) + 600

setAMFObject

将对象用AMF格式序列化保存

  • keyItem {String} 键名
  • value {Object} 值

getAMFObject

获取AMF格式序列化的对象,获取的对象的ret.data.value不需要再JSON.parse

  • keyItem {String} 键名

warpper

用kedis包裹一个promise

  • key {String} 键名
  • timeout {Number} 缓存时间以毫秒为单位
  • promise {Promise}
  • needOldData {Function} 是否需要旧数据,默认不要旧数据,返回值为true本次返回旧数据,返回值为false去取新数据,接受参数(expire, content) expire:过期时间戳,content:内容。

warpperAMF

用kedis包裹一个promise, 使用AMF编解码

  • key {String} 键名
  • timeout {Number} 缓存时间以毫秒为单位
  • promise {Promise}
  • needOldData {Function} 是否需要旧数据,默认不要旧数据,返回值为true本次返回旧数据,返回值为false去取新数据,接受参数(expire, content) expire:过期时间戳,content:内容。

getCprString

使用和getString一样,实现方法是key里面如果带cpr_会有一个解压逻辑

setCprString

使用和setString一样,实现方法是key里面如果带cpr_会有一个压缩逻辑,不带cpr_就会直接调用setString

getCprStringBatch

使用和getStringBatch一样,可以看做是getCprString的批量操作。具体实现请看代码。

setCprStringBatch

使用和setStringBatch一样,可以看做是setCprString的批量操作。具体实现请看代码。