從網上找的一些資料顯示,
時間間隔 | 記憶量 |
---|---|
剛剛記憶完畢 | 100% |
20分鐘後 | 58.2% |
1小時後 | 44.2% |
8-9小時後 | 35.8% |
1天后 | 33.7% |
2天后 | 27.8% |
6天后 | 25.4% |
1個月後 | 21.1% |
遺忘的曲線和內容有關,也和個人有關。有很多次,把事情忘記,或者是記錯,給我帶來了很多的困擾。一直沒能找到有效的記憶方法,看到了艾賓浩斯遺忘曲線,發現很有道理。
記憶類型 | 時間間隔 |
---|---|
短時記憶 | 5分鐘,20分鐘, 1小時 |
長時記憶 | 12小時,1天,3天,7天,14天,30天 |
用表格來記憶,肯定是不符合現階段大部分人的習慣的,尤其是對我這種不怎麼手寫的人,會覺得手寫表格有點繁瑣,而且不易攜帶,不好用。Mac上訪問日曆又需要很多權限,不好處理。使用提醒軟件是個不錯的選擇,除此之外,我還想自己試試。
存儲介質模式可選:
- 藉助Redis的zset實現一個TimeLine模式。
- InfluxDB時序數據庫。
觸發機制也可以有多個:
- 郵件 (重,不及時)
- IFTTT (好用,用webhook配合notification即可,而且可用於安卓和iOS)
- OSSCRIPT (平臺受限,macOS獨有)
模式 | 優點 | 缺點 |
---|---|---|
Redis | 輕量、方便 | 不容易查找,update操作失效 |
InfluxDB | 易於查詢更新 | 引入了外界服務,部署困難加大,不穩定性提高。 |
我的阿里雲服務器端口受安全組影響, 無法使用,所以這倆思路都試試
#coding: utf8
# 未測試,不保證可以正常運行
import requests
from influxdb import InfluxDBClient
import tornado.ioloop
import tornado.web
import time
import json
HOST = "http://localhost:8086/"
QUERY_URL = HOST + "query?pretty=true"#&data-urlencode=true"
WRITE_URL = "{}{}?db={}".format(HOST, "write", "mydb")
client = InfluxDBClient("localhost", 8086, database="mydb")
roundbin = [
# 短期記憶
5 * 60,
20 * 60,
60 * 60,
# 長期記憶
12 * 60 * 60,
86400,
86400 * 2,
86400 * 5,
86400 * 8,
86400 * 14,
]
# 基於艾賓浩斯遺忘曲線進行事件添加:在5分鐘後重復一遍,20分鐘後再重複一遍,1小時後,12小時後,1天后,2天后,5天后,8天后,14天后就會記得很牢。
def generate_event(tablename, content):
events = []
curtime = int(time.time())
for item in roundbin:
# 默認一個存儲結構,根據需要進行修改
schema = [{
"measurement": tablename,
"tags": {
"content": content,
"tiptime": curtime + item
},
"fields": {
# extra data fields
}
}]
events.append(schema)
del schema
return events
def get():
ret = client.query('select * from "users"')
print(ret)
# response = requests.get(QUERY_URL+'&db=mydb&q=select * from "users"').json()
# print(response['results'][0]['series'][0]['values'])
def write():
payload = [
{
"measurement": "users",
"tags": {
"name": "hello",
"age": 20,
"address": "MIT"
},
"fields": {
"value": 10.0
}
}
]
global client
client.write_points(payload)
class MainHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self.write("helloworld")
class QueryHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
tablename = self.request.arguments.get("tablename")
curtime = int(time.time())
dayoffset = curtime + 86400*7
global client
rows = client.query('select * from "users"')
print(rows)
self.write(json.dumps(rows))
class WriteHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
content = self.request.arguments.get("content")
tablename = self.request.arguments.get("tablename")
events = generate_event(tablename, content)
print(events)
for event in events:
client.write_points(event)
self.write(json.dumps(events))
def make_app():
return tornado.web.Application([
(r"/", MainHandler),
(r"/query/([0-9]+)", QueryHandler),
(r"/write/[a-zA-Z0-9_]+", WriteHandler)
])
if __name__ == "__main__":
print(get())
app = make_app()
app.listen(8080)
tornado.ioloop.IOLoop.current().start()
# print(generate_event(tablename="users", content="helloworld"))
# print(generate_event(measurement="users", tags={"name":"fucker", "age":20, "address":"北京"}))
總結:
有的時候思路很多,實際上去做的可能遠遠不夠。艾賓浩斯遺忘曲線是一個很有價值的東西,值得動動手,養成一個經常回顧知識的好習慣,對自己應該會很有幫助的吧。