Skip to content

Implement result caching in the Message class #3

@NLthijs48

Description

@NLthijs48

This would improve cases where a Message is first constructed and then sent to a set of players. Currently the Message class will parse and generate the message again for each sendTo() call (variable replacement also does another run, but will find nothing to replace anymore).

Implementation:

  • After parsing, save the result in the Message instance (currently a static result cache does not seem useful).
  • After generating console or JSON output, save the result.
  • When modified (appending, setting replacements), delete saved results.
  • When sending only parse/generate when there is no saved result.
  • Since Message instances are normally short-lived, reloading the message files would not cause problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions