forked from otale/tale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baf161a
commit 61dc113
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.tale.task; | ||
|
||
import com.blade.ioc.annotation.Bean; | ||
import com.blade.task.annotation.Schedule; | ||
import io.github.biezhi.anima.Anima; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
/** | ||
* 定时刷新 PV 到数据库 | ||
* | ||
* @author biezhi | ||
* @date 2018/8/13 | ||
*/ | ||
@Bean | ||
public class PageViewTask { | ||
|
||
// public static Map<Long, AtomicLong> counts = new ConcurrentHashMap<>(); | ||
// | ||
// @Schedule(cron = "*/5 * * * * ?") | ||
// public void syncToDB() { | ||
// Set<Long> cids = counts.keySet(); | ||
// for (Long cid : cids) { | ||
// long count = counts.get(cid).getAndSet(0); | ||
// Anima.execute("update contents set hits = hits + " + count + " where cid = " + cid); | ||
// } | ||
// } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters