Skip to content

Joursion/koa_redis_session_ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-cache

A simple cache middleware for koa.

koa >= 2.x , Requires Node 7.6 or greater for async/await support.

Usage

  • npm koa-redis-cache-ts
import * as Koa from "koa"
import * as Cache_ts from "koa-redis-cache-ts"

const app = new Koa()
const Cache = new Cache_ts({
    port: "",
    host: "",
    database: "",
    expire: "" // default is one day
})

app.use(Cache())

app.post('/', (ctx, next) => {
    ctx.SET('hello', 'world')  // set a key 'hello' with value 'world'
})

app.get('/', (ctx) => {
    let hello = await ctx.GET('hello')
    ctx.body = {
        hello: hello
    }
})

About

A session middlreware for koa@2.x by redis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages