Skip to main content

Cache Cleanup

Cache Cleanup removes expired cache entries based on their TTL (Time To Live) settings to keep your database clean and efficient.

What It Doesโ€‹

The Cache Cleanup tool:

  1. Checks all cache entries for expiration
  2. Finds entries where expires_at is in the past
  3. Permanently deletes expired entries
  4. Reports how many were removed

When to Useโ€‹

Good Times to Runโ€‹

  • Weekly maintenance: Keep database clean
  • Monthly review: Clear accumulated expired entries
  • Before major updates: Clean slate for new content
  • When database seems slow: Free up space

How Oftenโ€‹

FrequencyRecommendation
WeeklyHigh-traffic systems
MonthlyStandard usage (recommended)
QuarterlyLow-traffic systems

Understanding TTL (Time To Live)โ€‹

Each cache entry can have a TTL that determines when it expires:

TTL SettingMeaning
No TTLEntry never expires automatically
30 daysEntry expires 30 days after creation
90 daysEntry expires 90 days after creation
CustomAny number of days

Why Entries Expireโ€‹

Entries should expire when:

  • Information changes regularly (deadlines, dates)
  • Content needs periodic review
  • Temporary information (events, announcements)

How to Useโ€‹

Running Cleanupโ€‹

  1. Go to the Maintenance page
  2. Find the Cache Cleanup section
  3. Click Cleanup Expired Entries
  4. Wait for the result message

Understanding Resultsโ€‹

The result shows how many entries were removed:

  • "Cleaned 0 expired entries" - No expired entries found (good!)
  • "Cleaned 15 expired entries" - 15 entries were removed

What Gets Deletedโ€‹

Deletedโ€‹

  • Entries where expires_at date has passed
  • Both active and inactive expired entries

NOT Deletedโ€‹

  • Entries without TTL (no expiration set)
  • Entries within their TTL period
  • Entries where expires_at is in the future

Before Running Cleanupโ€‹

Check What Will Be Removedโ€‹

Before cleanup, you can preview expired entries:

  1. Go to Cache Management
  2. Sort by expiration date
  3. Review entries that are past due
  4. Decide if any should be renewed instead

Renew Important Entriesโ€‹

If you find expired entries worth keeping:

  1. Edit the entry in Cache Management
  2. Update the content if needed
  3. Set a new TTL or remove TTL
  4. Save - the entry is now renewed

After Cleanupโ€‹

Verify Successโ€‹

  • Check the result message for count
  • Review Cache Management to confirm removal
  • Check Performance Metrics for impact

No Impact on Active Contentโ€‹

Cleanup only affects expired entries:

  • Active, non-expired entries are untouched
  • Users won't notice any change
  • Only outdated content is removed

Best Practicesโ€‹

Set Appropriate TTLsโ€‹

When creating cache entries, consider TTL:

Content TypeSuggested TTL
Evergreen contentNo TTL
Semester-specific120 days
Event information30-60 days
Deadline datesUntil deadline + 7 days

Regular Maintenanceโ€‹

  • Run cleanup on a regular schedule
  • Don't let expired entries accumulate
  • Monitor the count trend over time

Review Before Deletingโ€‹

  • Periodically check what's expiring
  • Renew valuable content
  • Update TTLs as needed

Troubleshootingโ€‹

Nothing Removedโ€‹

If cleanup shows 0 entries:

  • You may not have expired entries (good!)
  • Check if TTLs are set on your entries
  • Review Cache Management for expiration dates

Too Many Removedโ€‹

If cleanup removes many entries:

  • Your TTLs may be too short
  • Review and adjust TTL settings
  • Consider which content should be permanent

Accidentally Deleted Important Contentโ€‹

Unfortunately, cleanup deletions are permanent. To prevent this:

  • Review expiring content regularly
  • Renew important entries before expiration
  • Use appropriate TTLs when creating entries

Related: