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?
