Beast Mode
Beast Mode is SpeedMate's intelligent automatic caching system that learns from traffic patterns to cache high-traffic pages automatically.
What is Beast Mode?
Traditional caching requires manual configuration of which pages to cache. Beast Mode eliminates this by:
- Analyzing Traffic: Monitors page views in real-time
- Learning Patterns: Identifies high-traffic pages automatically
- Auto-Caching: Caches popular pages without manual intervention
- Adaptive: Adjusts cache strategy based on changing traffic
How It Works
User Request → Traffic Analysis → Score Calculation
↓
Score > Threshold?
↓
Auto-Cache Page
↓
Serve from CacheScoring Algorithm
Beast Mode scores pages based on:
- Request Count: Number of requests in time window
- Request Rate: Requests per minute
- Response Time: Average page generation time
- Resource Usage: Memory and database query count
Formula:
score = (requests * 10) + (rate * 5) + (response_time / 100)Threshold: score >= 50 triggers auto-caching
Configuration
Enable Beast Mode
php
update_option('speedmate_settings', [
'mode' => 'beast',
'beast_threshold' => 50, // Minimum score
'beast_time_window' => 3600, // 1 hour window
'beast_whitelist' => [], // Always cache
'beast_blacklist' => [], // Never cache
]);Via WordPress Admin
- Navigate to Settings > SpeedMate
- Set Mode to
Beast - Configure threshold and whitelist
- Save changes
Whitelist Rules
Force-cache specific patterns:
php
update_option('speedmate_settings', [
'beast_whitelist' => [
'/blog/*', // All blog posts
'/category/*', // All categories
'/tag/*', // All tags
'/shop/*', // All shop pages
'/', // Homepage
]
]);Programmatic Whitelist
php
add_filter('speedmate_beast_whitelist', function($whitelist) {
// Add custom post type
$whitelist[] = '/products/*';
// Add specific pages
$whitelist[] = '/about';
$whitelist[] = '/contact';
return $whitelist;
});Blacklist Rules
Exclude specific patterns from Beast Mode:
php
update_option('speedmate_settings', [
'beast_blacklist' => [
'/checkout/*', // E-commerce checkout
'/cart/*', // Shopping cart
'/my-account/*', // User account pages
'/admin/*', // Admin pages
]
]);Default Exclusions
Beast Mode automatically excludes:
- Admin pages (
/wp-admin/*) - User account pages
- Checkout/cart pages (WooCommerce)
- Search results
- Preview pages
- Password-protected pages
Traffic Analysis
Real-Time Monitoring
bash
# View current traffic stats
wp speedmate stats
# Monitor Beast Mode decisions
tail -f wp-content/speedmate.log | grep beastTraffic Data Structure
json
{
"url": "/blog/post-name",
"hits": 142,
"rate": 2.3,
"avg_response": 450,
"score": 87,
"cached": true,
"cache_time": "2026-01-22T10:30:00Z"
}Performance Metrics
Before Beast Mode
High Traffic Page:
- Requests: 1000/hour
- Response Time: 500ms
- Database Queries: 80/request
- Memory Usage: 80MB
- Total Time: 500 secondsAfter Beast Mode
High Traffic Page:
- Requests: 1000/hour
- Response Time: 3ms (cached)
- Database Queries: 0/request
- Memory Usage: 5MB
- Total Time: 3 secondsPerformance Gain: 99.4% faster
Advanced Features
Adaptive Caching
Beast Mode adapts cache strategy based on:
- Time of Day: Higher threshold during low traffic
- Day of Week: Lower threshold on weekends
- Seasonal Traffic: Adjusts for traffic spikes
- Resource Availability: Reduces caching under load
php
add_filter('speedmate_beast_threshold', function($threshold) {
$hour = (int) date('H');
// Lower threshold during business hours
if ($hour >= 9 && $hour <= 17) {
return $threshold * 0.8;
}
// Higher threshold at night
return $threshold * 1.2;
});Cache Warming Integration
Beast Mode automatically triggers cache warming for:
- Related posts
- Category archives
- Author pages
- Next/previous pagination
Dynamic TTL
Cache lifetime adjusts based on update frequency:
php
add_filter('speedmate_beast_ttl', function($ttl, $url) {
// Longer TTL for static pages
if (preg_match('/^\/(about|contact)/', $url)) {
return 86400; // 24 hours
}
// Shorter TTL for blog posts
if (preg_match('/^\/blog\//', $url)) {
return 3600; // 1 hour
}
return $ttl;
}, 10, 2);Monitoring
Dashboard Widget
View Beast Mode stats in WordPress admin:
Beast Mode Status
━━━━━━━━━━━━━━━━━━━━
Status: Active
Auto-Cached: 142 pages
Traffic Hits: 1,245
Avg Score: 67
Cache Hit Rate: 94.2%WP-CLI Monitoring
bash
# Beast Mode stats
wp speedmate info | grep -A5 "Beast Mode"
# Top scoring pages
wp eval "print_r(\SpeedMate\Utils\Stats::get_top_scored());"
# Recent auto-cached pages
wp eval "print_r(\SpeedMate\Utils\Stats::get_recent_cached());"Logging
php
// Enable Beast Mode logging
update_option('speedmate_settings', [
'logging_enabled' => true,
'log_level' => 'info'
]);Log entries:
json
{
"level": "info",
"event": "beast_auto_cache",
"url": "/blog/popular-post",
"score": 87,
"threshold": 50,
"timestamp": "2026-01-22T10:30:00Z"
}Best Practices
- Start with Conservative Threshold: Use default 50, adjust based on traffic
- Monitor Regularly: Check cache hit rates and scores
- Use Whitelist for Critical Pages: Force-cache homepage, landing pages
- Blacklist User-Specific Content: Exclude checkout, account pages
- Enable Cache Warming: Pre-cache likely navigation paths
- Review Logs Periodically: Identify patterns and adjust rules
Troubleshooting
Pages Not Auto-Caching
- Check traffic meets threshold
- Verify page not in blacklist
- Review exclusion rules
- Check cache directory permissions
Too Many Pages Cached
- Increase threshold
- Add patterns to blacklist
- Reduce time window
- Enable stricter scoring
Cache Thrashing
- Increase TTL
- Reduce auto-invalidation triggers
- Use cache warming
- Review whitelist rules