BoxCache Stores
BoxCache object stores provide the storage layer for cached data with different persistence and performance characteristics
Last updated
Was this helpful?
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.
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
In-Memory
No
Memory-sensitive applications, automatic garbage collection support
Maximum Speed → ConcurrentStore - Thread-safe in-memory storage with minimal overhead
Memory Efficiency → ConcurrentSoftReferenceStore - Allows JVM to reclaim memory under pressure
Persistence → FileSystemStore - Survives restarts, ideal for compiled templates and configurations
Distribution → JDBCStore - Share cache across multiple servers in clustered environments
High-Traffic Web Application:
Multi-Server Deployment:
Template Compilation Cache:
All object stores support the standard BoxCache configuration properties:
maxObjects - Maximum number of cached items
evictionPolicy - LRU, LFU, FIFO, LIFO, or RANDOM
evictCount - Number of items to evict when limit is reached
defaultTimeout - Time-to-live in seconds
defaultLastAccessTimeout - Idle timeout in seconds
reapFrequency - Cleanup frequency in seconds
Store-specific properties are documented on each store's individual page.
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
Choose your store based on performance, persistence, and distribution requirements
Review the specific store documentation for configuration details
Configure your cache in boxlang.json or Application.bx
Test your configuration to ensure optimal performance
For general caching concepts and provider configuration, see the Caching Overview.
Last updated
Was this helpful?
Was this helpful?
{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "ConcurrentStore",
"maxObjects": 10000,
"evictionPolicy": "LRU"
}
}{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "JDBCStore",
"datasource": "sharedCache",
"table": "app_cache"
}
}{
"provider": "BoxCacheProvider",
"properties": {
"objectStore": "FileSystemStore",
"directory": "/var/caches/templates"
}
}