0.1.10 • Published 4 years ago

wechaty-puppet-cache v0.1.10

Weekly downloads
53
License
Apache-2.0
Repository
-
Last release
4 years ago

WECHATY-PUPPET-CACHE

Powered by Wechaty NPM Version TypeScript Linux/Mac Build Status

Aim

  1. support multiple types of cache store, mongo and flash-store
  2. defined the object payload structure for wechaty-puppet-xxx

Install

1. Check your Node version first

node --version // v10.16.0

for windows system

To make sure you could install wechaty-puppet-cache successfully, you have to start PowerShell as Administrator and run these commands:

npm install -g windows-build-tools

npm install -g node-gyp

2. Cache store types

3. How to use wechaty-puppet-cache

For default

import PupetCache from 'wecahty-puppet-cache'

const puppetCache = new PuppetCache({
  name: 'your name',
})
const messageCache = puppetCache.genMessageClient()
const contactCache = puppetCache.genContactClient()
const roomMemberCache = puppetCache.genRoomMemberClient()
const roomCache = puppetCache.genRoomClient()
const friendshipCache = puppetCache.genFriendshipClient()
const roomInvitationCache = puppetCache.genRoomInvitationClient()
const otherCache = puppetCache.genClient('your cache name')

For mongo

import PupetCache, { PuppetCacheStoreOptions } from 'wecahty-puppet-cache'

const storeOptions: PuppetCacheStoreOptions = {
  type: 'mongo',
  url: 'mongodb://127.0.0.1:27017/testdb',
}
const puppetCache = new PuppetCache({
  name: 'your name',
  storeOptions,
})

4. Caution

When you use mongo as cache store, the table name list:

  1. wechaty-cache-message-raw-payload

  2. wechaty-cache-room-raw-payload

  3. wechaty-cache-contact-raw-payload

  4. wechaty-cache-room-invitation-raw-payload

  5. wechaty-cache-room-member-raw-payload

  6. wechaty-cache-friendship

Please make sure there's no conflict with your table name.

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.4

4 years ago

0.1.6

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.1.5

4 years ago