boxlang-cachinglisted
Install: claude install-skill ortus-boxlang/skills
# BoxLang Caching
## Overview
BoxLang provides a flexible, pluggable caching system managed by `CacheService`.
Multiple named cache regions can coexist, each backed by a different provider.
The default in-memory cache is available immediately; Redis, Couchbase, JDBC, and
filesystem caches are available via modules.
## Cache Configuration
### In `boxlang.json`
```json
{
"caches": {
"default": {
"provider": "BoxCacheProvider",
"properties": {
"maxObjects": 1000,
"defaultTimeout": 60,
"defaultLastAccessTimeout": 30,
"reapFrequency": 5,
"evictionPolicy": "LRU"
}
},
"sessions": {
"provider": "BoxCacheProvider",
"properties": {
"maxObjects": 5000,
"defaultTimeout": 120
}
},
"queries": {
"provider": "jdbc",
"properties": {
"datasource": "mainDB",
"table": "cache_entries"
}
},
"files": {
"provider": "filesystem",
"properties": {
"directory": "/tmp/bxcache"
}
}
}
}
```
## Basic Cache Operations
```boxlang
// Store a value (default cache, 60-minute TTL)
cachePut( "user_#userId#", userStruct )
// Store with explicit TTL (timespan)
cachePut( "user_#userId#", userStruct, createTimeSpan( 0, 1, 0, 0 ) ) // 1 hour