Quick Reference
Essential CQL configuration and caching patterns for quick copy-paste.
Basic Setup
# Minimal
CQL.configure do |c|
c.db = "postgresql://localhost/myapp"
end
# Development
CQL.configure do |c|
c.db = "postgresql://localhost/myapp"
c.log_level = :debug
c.auto_sync = true
c.cache.on = true
end
# Production
CQL.configure do |c|
c.db = ENV["DATABASE_URL"]
c.env = "production"
c.pool_size = 25
c.monitor_performance = true
c.auto_sync = false
c.cache.on = true
c.cache.store = "redis"
c.cache.redis_url = ENV["REDIS_URL"]
endConfiguration Properties
Cache Configuration
Environment Patterns
Web Framework Integration
Kemal
Lucky
Manual Request Caching
Cache Management
Fragment Caching
Database URLs
Helper Methods
Schema Management
Common Patterns
Complete E-commerce Setup
Blog/CMS Setup
API Service Setup
Troubleshooting
Performance Tips
Enable caching early - it's safe and improves performance
Use request caching for web apps - eliminates duplicate queries
Start with memory cache - upgrade to Redis when needed
Set appropriate TTLs - balance freshness vs performance
Monitor hit rates - should be >60% for good cache usage
Use fragment caching for expensive operations
Tag fragments properly - enables precise invalidation
Environment Variables
Last updated
Was this helpful?