# Cache Management for Settings

## Why Cache Issues Happen

The application caches settings for 1 hour (3600 seconds) to improve performance. When you update settings in the admin panel, the cache is automatically cleared. However, if you:
- Manually update the database
- Experience a save error
- Have multiple admin sessions

The cache might not be cleared properly.

## How to Clear Cache

### Method 1: Via Command Line (Recommended)
```bash
php artisan cache:clear
```

### Method 2: Via Admin Panel
The admin panel automatically clears cache when you save settings. Just click "Save All Settings" again.

### Method 3: Wait for Cache Expiry
Cache automatically expires after 1 hour.

## Current Settings Values (After Cache Clear)

- **Level 1 Commission**: 7%
- **Level 2 Commission**: 5%
- **Level 3 Commission**: 2%

These are the values you set in the admin panel and they are now active.

## Verification

To verify current cached values:
```bash
php artisan tinker --execute="echo 'Level 1: ' . \App\Models\SiteSetting::get('referral_level_1_commission') . '%';"
```

## How the System Works

1. **Admin saves settings** → Cache is cleared automatically
2. **API requests settings** → Checks cache first, then database
3. **Cache expires** → Next request fetches fresh data from database
4. **New cache created** → Stored for 1 hour

Your commission percentages (7%, 5%, 2%) are now active and will display correctly on the Team page after refreshing!
