TeamspeakStats
TeamspeakStats copied to clipboard
Cache stats
This is a complex topic. My current implementation plan (mostly written down here for myself, but maybe someone can suggest another approach):
-
tsstats.log._parse_detailsshould return aChangeSetof actions to be applied on aClients-object instead applying them directly - the actual caching will take place in
tsstats.log.parse_logs: the caching-status of aTimedLog-object will be checked before calling_parse_details(by comparing a hash saved in cache and the current file hash => new lines in a log file will lead to parsing the file again)- if cached: get
ChangeSetfrom cache and apply it to theClients-object - if not cached: call
_parse_detailsreturningChangeSetand apply it to theClients-object
- if cached: get
A potential idea for caching the data is to store it in an sqlite database. Python has first-class support for sqlite, and it's a simple reliable data structure that anyone can work with.
Yeah, sqlite is an option.
My parsing rewrite is (nearly) finished, I just have to fix some tests: parsing_refactor
Event-objects should be easy to safe in a sqlite-database.
Sounds good!