generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Performance Tips
Azizul Hakim edited this page Jun 12, 2025
·
1 revision
Optimize Laravel Setanjo for production environments with these essential performance strategies.
Always enable caching in production:
// config/setanjo.php
'cache' => [
'enabled' => true,
'store' => 'redis', // Recommended
'ttl' => 3600, // 1 hour
],Environment configuration:
# Production
SETANJO_CACHE_ENABLED=true
SETANJO_CACHE_STORE=redis
SETANJO_CACHE_TTL=7200
# Development
SETANJO_CACHE_ENABLED=false- Fast in-memory storage
- Supports cache tags
- Scales with multiple app instances
- Good alternative for high-performance
- Lightweight and fast
- Suitable for smaller applications
- Use shorter TTL (1800s)
// config/setanjo.php
'validation' => [
'enabled' => env('APP_ENV') !== 'production',
'throw_exceptions' => true,
],SHOW INDEX FROM settings;
-- Should include optimized indexes for performance// ✅ Efficient
Settings::for($user)
->set('theme', 'dark')
->set('language', 'en')
->set('timezone', 'UTC');With proper caching:
- Global settings: ~10x faster (0.1-0.5ms vs 2-5ms)
- Tenant settings: ~5x faster (0.2-1ms vs 3-8ms)
- Bulk operations: ~10x faster (5-20ms vs 50-200ms)
- Redis/Memcached configured
- Cache TTL optimized (3600-7200s)
- Validation disabled in production
- Database indexes verified
- Batch loading implemented
- Method chaining used
# Clear cache during development
php artisan setanjo:clear-cache
# Clear specific tenant cache
php artisan setanjo:clear-cache --tenant="App\Models\User:1"
# Clear all setanjo cache
php artisan setanjo:clear-cache --allMade with ❤️ by @AHS12 • © 2025 • MIT Licensed
- Home - Homepage of the wiki
- Installation Guide - Set up Setanjo in your Laravel project
- Setup & Configuration - Configure tenancy modes and basic options
- Quick Start Examples - Get up and running in minutes
- Tenancy Modes - Understanding strict vs polymorphic modes
- Facade API Reference - Complete method documentation
- HasSettings Trait - Uses of HasSrttings trait
- Commands - Artisan commands for management
- Performance Tips - Optimization best practices