TeamspeakStats icon indicating copy to clipboard operation
TeamspeakStats copied to clipboard

Cache stats

Open Thor77 opened this issue 9 years ago • 4 comments

Suggested by this forum-post

Thor77 avatar Apr 16 '17 20:04 Thor77

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_details should return a ChangeSet of actions to be applied on a Clients-object instead applying them directly
  • the actual caching will take place in tsstats.log.parse_logs: the caching-status of a TimedLog-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 ChangeSet from cache and apply it to the Clients-object
    • if not cached: call _parse_details returning ChangeSet and apply it to the Clients-object

Thor77 avatar May 14 '17 20:05 Thor77

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.

djmattyg007 avatar Aug 29 '17 09:08 djmattyg007

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.

Thor77 avatar Aug 29 '17 10:08 Thor77

Sounds good!

djmattyg007 avatar Aug 29 '17 22:08 djmattyg007