metomi/isodatetime

Cache method calls

MetRonnie opened this issue · 1 comments

Follow on from #162

Now that the data classes have been made hashable, the next step is to implement some form of lru_cache for some of the methods.

I think we wouldn't implement it for the certain methods whose return value depends on e.g. whether the Duration is in weeks mode or normal mode, such as get_is_in_weeks() or __str__().

I think we wouldn't implement it for the certain methods whose return value depends on e.g. whether the Duration is in weeks mode or normal mode, such as get_is_in_weeks() or __str__().

Actually, should be possible to do something like use a private helper method that accepts an arg is_in_weeks and cache that instead, then wrap that helper with the public method