BoxCache Stores
BoxCache object stores provide the storage layer for cached data with different persistence and performance characteristics
Object stores are the foundational storage layer of the BoxLang cache engine. They provide the actual mechanism for storing, retrieving, and managing cached objects in memory, on disk, or in distributed databases. While cache providers coordinate user interactions and act as a service layer, object stores handle the low-level data persistence and retrieval operations.
🏗️ Store Architecture
BoxCache's flexible architecture allows you to choose the right storage backend for your caching needs:
In-Memory Stores - Fast, volatile storage for frequently accessed data
Disk-Based Stores - Persistent storage that survives application restarts
Database-Backed Stores - Distributed caching across multiple application instances
Special-Purpose Stores - Testing and development utilities
📦 Available Object Stores
In-Memory
No
Memory-sensitive applications, automatic garbage collection support
🎯 Choosing the Right Store
Performance Requirements
Maximum Speed →
ConcurrentStore- Thread-safe in-memory storage with minimal overheadMemory Efficiency →
ConcurrentSoftReferenceStore- Allows JVM to reclaim memory under pressurePersistence →
FileSystemStore- Survives restarts, ideal for compiled templates and configurationsDistribution →
JDBCStore- Share cache across multiple servers in clustered environments
Use Case Examples
High-Traffic Web Application:
{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "ConcurrentStore",
"maxObjects": 10000,
"evictionPolicy": "LRU"
}
}Multi-Server Deployment:
{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "JDBCStore",
"datasource": "sharedCache",
"table": "app_cache"
}
}Template Compilation Cache:
{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "FileSystemStore",
"directory": "/var/caches/templates"
}
}🔧 Common Configuration Properties
All object stores support the standard BoxCache configuration properties:
maxObjects- Maximum number of cached itemsevictionPolicy- LRU, LFU, FIFO, LIFO, or RANDOMevictCount- Number of items to evict when limit is reacheddefaultTimeout- Time-to-live in secondsdefaultLastAccessTimeout- Idle timeout in secondsreapFrequency- Cleanup frequency in seconds
Store-specific properties are documented on each store's individual page.
📚 Store-Specific Documentation
Click on any store below to view detailed configuration options, features, and usage examples:
ConcurrentStore - Thread-safe in-memory caching
ConcurrentSoftReferenceStore - Memory-sensitive caching with soft references
FileSystemStore - Disk-based persistent caching
JDBCStore - Database-backed distributed caching (New in 1.7.0)
BlackHoleStore - Mock store for testing
🚀 Next Steps
Choose your store based on performance, persistence, and distribution requirements
Review the specific store documentation for configuration details
Configure your cache in
boxlang.jsonorApplication.bxTest your configuration to ensure optimal performance
For general caching concepts and provider configuration, see the Caching Overview.
Last updated
Was this helpful?
