Commit 7b44c25e authored by 赵威's avatar 赵威

save data

parent 0a302563
...@@ -12,12 +12,12 @@ object Redis { ...@@ -12,12 +12,12 @@ object Redis {
def save(contentF: 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}" val key = s"streaming:candidate:${contentType}:device_id:${deviceId}"
pRc4.del(key)
contentF.foreach { seq => contentF.foreach { seq =>
val ids = seq.map(c => c.id) val ids = seq.map(c => c.id)
if (ids.size > 0) { if (ids.size > 0) {
println(ids.head, ids.tail) pRc4.del(key)
pRc4.lpush(key, ids.head, ids.tail) ids.foreach(id => pRc4.lpush(key, id))
pRc4.expire(key, 60 * 60 * 24 * 15) 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