import com.google.common.base.Ticker
import com.google.common.cache.Cache
import com.google.common.cache.CacheBuilder
import com.google.common.base.Ticker
import com.google.common.cache.Cache
import com.google.common.cache.CacheBuilder
import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.data.PostReply
import net.pterodactylus.sone.data.Sone
import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.data.PostReply
import net.pterodactylus.sone.data.Sone
private val cache: Cache<Iterable<Phrase>, Pagination<Post>> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build()
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
private val cache: Cache<Iterable<Phrase>, Pagination<Post>> = CacheBuilder.newBuilder().ticker(ticker).expireAfterAccess(5, MINUTES).build()
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
.scoreAndPaginate(phrases) { it.allText() }
}.apply { page = freenetRequest.parameters["postPage"].emptyToNull?.toIntOrNull() ?: 0 }
.scoreAndPaginate(phrases) { it.allText() }
}.apply { page = freenetRequest.parameters["postPage"].emptyToNull?.toIntOrNull() ?: 0 }
templateContext["sonePagination"] = sonePagination
templateContext["soneHits"] = sonePagination.items
templateContext["postPagination"] = postPagination
templateContext["sonePagination"] = sonePagination
templateContext["soneHits"] = sonePagination.items
templateContext["postPagination"] = postPagination