koajs / koa-redis

Redis storage for Koa session middleware/cache with Sentinel and Cluster support
MIT License
352 stars 40 forks source link

Default method of serialize and unserialize in readme #42

Closed Joseph7451797 closed 6 years ago

Joseph7451797 commented 6 years ago

Recently I am working on a side project and use Koa framework. I use koa-redis to get value saved from another server which use Node redis.

Problem encountered is the result from unserialize method in koa-redis because I don't use JSON.stringify while setting(using Node redis). I know use explicit serialized function is a good habit.

I found this result after surveying source code. Can it be written in README.md explicitly?

DaAwesomeP commented 6 years ago

@Joseph7451797 I'm not sure if I understand what your issue is. koa-redis expects JSON data stored in Redis. This is a requirement of koa-generic-session.

Joseph7451797 commented 6 years ago

Usage koa-redis works with koa-generic-session (a generic session middleware for koa).

@DaAwesomeP I got it after reading README.md again.

Maybe the key point of my issue is that I use koa-redis independently(not with ko-generic-session). I will handle JSON data by myself. Thank for your reply.