Scope Storage
Use Couchbase as the storage backend for BoxLang session and application scopes, providing distributed, fault-tolerant scope storage that scales across multiple servers.
🎯 Session Storage
Configuration
component {
this.name = "MyApp";
this.sessionManagement = true;
this.sessionStorage = "couchbase-sessions";
this.sessionTimeout = createTimeSpan(0, 2, 0, 0); // 2 hours
this.caches["couchbase-sessions"] = {
"provider": "Couchbase",
"properties": {
"connectionString": "couchbase://localhost",
"username": "Administrator",
"password": "password",
"bucket": "myapp",
"scope": "sessions",
"collection": "user_sessions"
}
};
}Using Session Scope
Benefits
🌐 Application Scope Storage
Configuration
Using Application Scope
🔧 Advanced Configuration
Separate Collections for Different Scope Types
Session Clustering
📊 Monitoring Session Activity
Query Active Sessions
Find Sessions by User
🧹 Session Cleanup
Manual Cleanup
Automatic Expiration
🔐 Security Best Practices
1. Use Dedicated Credentials
2. Use TLS/SSL
3. Separate Sensitive Data
🎯 Performance Optimization
Session Granularity
Lazy Loading
🐛 Troubleshooting
Sessions Not Persisting
Connection Errors
Performance Issues
🔗 Next Steps
Last updated
Was this helpful?
