Skip to content

Cache the page routing table #1

Open

Description

@duguankui

SiteRouteResolver.ResolveAsync handles a URL that names a content (/blog/my-trip) by calling IPageRepository.GetRoutableListAsync(), which loads every active page in the tenant on every such request, then walks them testing route prefixes.

That is correct but unbounded: the cost of resolving one URL grows with the number of pages on the site. Only the exact-route-match path (step 1) avoids it.

The page collection is close to read-only in normal operation — pages change when someone edits the site structure, not when content is published — so it is a good caching candidate.

What to do

  • Cache the routable page list per tenant (IDistributedCache<T>), keyed by tenant id.
  • Invalidate on page create / update / delete. PageManager is the single write path, so that is where invalidation belongs.
  • Keep the ordering guarantee: longest route first. That ordering is load-bearing — it is what stops /blog from claiming /blog-archive/..., and it is covered by tests today.

References

  • src/Dignite.Sites.Domain/Routing/SiteRouteResolver.cs
  • src/Dignite.Sites.EntityFrameworkCore/Pages/EfCorePageRepository.cs (GetRoutableListAsync)
  • Design doc §3.1, §3.4

Activity

  1. added this to the P0 Content kernel milestone on Aug 4, 2026
  2. added
    phase: P0Content kernel - landed, these are follow-ups
    area: routingRoute resolution and URL structure
    tech debtKnown shortcut taken during P0
    group: 0-kernel-debtIndependent P0 cleanup - blocks nothing, insert anywhere
    on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: routingRoute resolution and URL structuregroup: 0-kernel-debtIndependent P0 cleanup - blocks nothing, insert anywherephase: P0Content kernel - landed, these are follow-upstech debtKnown shortcut taken during P0

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions