Skip to content

Instantly share code, notes, and snippets.

@kyu999
Created November 20, 2014 04:06
Show Gist options
  • Save kyu999/744d9567eaebdc68cf1c to your computer and use it in GitHub Desktop.
Save kyu999/744d9567eaebdc68cf1c to your computer and use it in GitHub Desktop.
backup manga mining
/*
def constructContents(i: Int): List[Content]
= (1 to amount).map{ i =>
val id = cache.get("week_pop_id_" + i)
val title = cache.get("week_pop_title_" + i)
val views = cache.get("week_pop_views_" + i)
val category = cache.get("week_pop_category_" + i)
val date = cache.get("week_pop_date_" + i)
val storages = content.storages.map( link => cache.rpush("week_pop_storages_" + i, link)
}
def saveContentsToRedis(contents: List[Content]) =
= contents.zipWithIndex.foreach{ each =>
val content = each._1
val i = each._2
cache.set("week_pop_id_" + i, content.id)
cache.set("week_pop_title_" + i, content.title)
cache.set("week_pop_views_" + i, content.views)
cache.set("week_pop_category_" + i, content.category)
cache.set("week_pop_date_" + i, content.date)
content.storages.foreach( link => cache.rpush("week_pop_storages_" + i, link)
}
*/
@kyu999
Copy link
Author

kyu999 commented Nov 20, 2014

/*
def toDbContent(content: Content): DBObject =
DBObject(
"id" -> content.id, "title" -> content.title, "category" -> content.category,
"date" -> content.date, "img" -> content.img, "views" -> content.views, "storages" -> content.storages
)

def toDbContents(contents: List[Content]) = contents.map( content => toDbContent(content) )

*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment