Skip to content

possible improvement: Blog Archives could be cached #8739

@MatteoPiovanelli

Description

@MatteoPiovanelli

public IEnumerable<KeyValuePair<ArchiveData, int>> GetArchives(BlogPart blogPart) {

In the current implementation, the query for the archive data is performed on every invocation of the method. For long-lived blogs this query fetches thousands of records from the database every time it's performed, and I don't think there's any need for that.

I propose it would be beneficial to cache its result, evicting those whenever a change to the archives is made (the methods invoked for that are in the BlogPartArchiveHandler).
Bonus, the "choice" between caching or not this could be controlled by a flag injectable from config file, so it's possible to decide about the tradeoff between doing the query more often vs storing stuff in memory on each tenant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions