tweak relation caches
parent
1333baf320
commit
f15ead0c7b
|
@ -80,9 +80,8 @@ final class RelationApi(
|
|||
def fetchAreFriends(u1: ID, u2: ID): Fu[Boolean] =
|
||||
fetchFollows(u1, u2) >>& fetchFollows(u2, u1)
|
||||
|
||||
private val countFollowingCache = cacheApi[ID, Int](8192, "relation.count.following") {
|
||||
_.expireAfterAccess(10 minutes)
|
||||
.maximumSize(32768)
|
||||
private val countFollowingCache = cacheApi[ID, Int](8_192, "relation.count.following") {
|
||||
_.maximumSize(8_192)
|
||||
.buildAsyncFuture { userId =>
|
||||
coll.countSel($doc("u1" -> userId, "r" -> Follow))
|
||||
}
|
||||
|
@ -92,9 +91,8 @@ final class RelationApi(
|
|||
|
||||
def reachedMaxFollowing(userId: ID): Fu[Boolean] = countFollowingCache get userId map (config.maxFollow <=)
|
||||
|
||||
private val countFollowersCache = cacheApi[ID, Int](131_072, "relation.count.followers") {
|
||||
_.expireAfterAccess(10 minutes)
|
||||
.maximumSize(131_072)
|
||||
private val countFollowersCache = cacheApi[ID, Int](32_768, "relation.count.followers") {
|
||||
_.maximumSize(32_768)
|
||||
.buildAsyncFuture { userId =>
|
||||
coll.secondaryPreferred.countSel($doc("u2" -> userId, "r" -> Follow))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue