Skip to content

Phase 1: Per-project cache tag invalidation on dashboard #5

Description

@dkwiebe

Summary

The dashboard API caches responses for 5 minutes using a flat key. This means users always see stale data and there's no way to bust the cache when new webhook events arrive for a specific project.

Implementation

In app/Http/Controllers/DashboardController.php, switch to tagged cache:

Cache::tags(['project-' . implode('-', $sortedProjectIds)])->remember($key, 300, fn() => ...);

After writing events in the webhook Job (see Phase 2 queuing issue), flush the relevant tag:

Cache::tags(['project-' . $project->id])->flush();

Note: Requires a cache driver that supports tags (Redis or Memcached). Add a conditional fallback for file/database drivers that skips tagging.

Acceptance Criteria

  • Dashboard reflects new events within seconds of arrival (when using Redis/Memcached)
  • Falls back gracefully to the existing 5-minute TTL if tags aren't supported
  • Cache is flushed per project, not globally

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions