Commit f74099d7 authored by 赵威's avatar 赵威

save data to redis

parent db6097cd
......@@ -66,7 +66,6 @@ object Main {
val a = ES.request(diaryReq)
Redis.save(ES.request(diaryReq), deviceId, "diary")
// ES.test(diaryReq, tractateReq, answerReq, serviceDiaryReq)
println("########################")
......
......@@ -10,15 +10,12 @@ object Redis {
val pRc4 = new RedisClient("172.16.50.145", 6379, 0, Some("XfkMCCdWDIU%ls$h"), 5000)
def save(content: Future[IndexedSeq[Content]], deviceId: String, contentType: String): Unit = {
def save(contentF: Future[IndexedSeq[Content]], deviceId: String, contentType: String): Unit = {
val key = s"streaming:candidate:${contentType}:device_id:${deviceId}"
println(key)
val a = content.map { seq =>
seq.map { c =>
println(c.id)
c.id
}
pRc4.del(key)
contentF.foreach { seq =>
pRc4.lpush(key, seq.map(c => c.id))
pRc4.expire(key, 60 * 60 * 24 * 15)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment