1.0.0 • Published 6 years ago

fastify-memorycache v1.0.0

Weekly downloads
1
License
WTFPL
Repository
github
Last release
6 years ago

fastify-memorycache

Mimic the memory cache of the Redis API

Implemented part

  • kv

    set get del dump exists expire persist randomkey append decr incr getrange strlen setrange ttl mget getset

  • hash (Part)

    hmset hgetall hexists hget hdel hmget hkeys hvals hlen

  • set (Part)

    sadd scard srem spop

example

const fastify = require('fastify')()
fastify.register(require('../app'))

fastify.get('/', function (request, reply) {
  fastify.cache.kv.set("a","aaaaaa")
  reply.send({ hello: fastify.cache.kv.get("a") })
})
fastify.listen(3000, function (err) {
  if (err) throw err
  console.log(`server listening on ${fastify.server.address().port}`)
})

document

English

简体中文