Commit 28744592 authored by 赵威's avatar 赵威

update id type

parent f74099d7
package com.gmei.up.utils package com.gmei.up.utils
case class Content(id: String, index: String, projects: String) case class Content(id: Long, index: String, projects: String)
...@@ -57,7 +57,7 @@ object ES { ...@@ -57,7 +57,7 @@ object ES {
implicit object ContentHitReader extends HitReader[Content] { implicit object ContentHitReader extends HitReader[Content] {
override def read(hit: Hit): Try[Content] = { override def read(hit: Hit): Try[Content] = {
val source = hit.sourceAsMap val source = hit.sourceAsMap
Try(Content(source("id").toString, hit.index, source("tags_v3").toString)) Try(Content(source("id").toString.toLong, hit.index, source("tags_v3").toString))
} }
} }
......
...@@ -14,8 +14,11 @@ object Redis { ...@@ -14,8 +14,11 @@ object Redis {
val key = s"streaming:candidate:${contentType}:device_id:${deviceId}" val key = s"streaming:candidate:${contentType}:device_id:${deviceId}"
pRc4.del(key) pRc4.del(key)
contentF.foreach { seq => contentF.foreach { seq =>
pRc4.lpush(key, seq.map(c => c.id)) val ids = seq.map(c => c.id)
pRc4.expire(key, 60 * 60 * 24 * 15) if (ids.size > 0) {
pRc4.lpush(key, ids.head, ids.tail)
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