CacheBox: Enterprise Caching
2.x
2.x
  • Introduction
  • What's New With 2.1.0
  • What's New With 2.0.0
  • About This Book
  • Author
  • Overview
    • CacheBox RefCard
    • Useful Resources
    • Features at a Glance
    • System Requirements
  • Installing CacheBox
    • Installation
  • Caching Concepts
    • Caching Considerations
    • Cache Loading
    • Definitions
    • Java Soft References
  • Cache Topologies
    • Single Instance/In-Process
    • Single Instance/Out-Process
    • Replicated
    • Distributed
  • CacheBox Architecture
    • CacheFactory
    • CacheBoxConfig
    • EventManager
    • ColdBox
    • LogBox
    • ICacheProvider
    • ICacheStats
    • IObjectStore
    • IEvictionPolicy
    • AbstractEvictionPolicy
    • IColdboxApplicationCache
  • Creating CacheBox
    • Common CacheFactory Methods
    • Cache Cleanup/Reaping
  • CacheBox Configuration
    • CacheBox DSL
      • LogBoxConfig
      • Scope Registration
      • Default Cache
      • Caches
      • Listeners
    • CacheBox Config Object
    • ColdBox Configuration
  • Cache Providers
    • Couchbase Providers
    • CF Providers
    • Railo Providers
    • Mock Provider
    • CacheBox Provider
  • CacheBox Object Stores
    • ConcurrentStore
    • ConcurrentSoftReferenceStore
    • DiskStore
    • JDBCStore
    • BlackholeStore
  • CacheBox Eviction Policies
    • Using Your Own Policy
  • CacheBox Event Model
    • CacheBox Events
    • Provider Events
    • Cache Listeners
  • Cache Reporting
    • Creating Your Own Skins
      • Skin Templates
      • ReportHandler
        • Action Commands
Powered by GitBook
On this page

Was this helpful?

Edit on Git
Export as PDF
  1. CacheBox Configuration

CacheBox Config Object

PreviousListenersNextColdBox Configuration

Last updated 7 years ago

Was this helpful?

The previous CacheBox DSL is a great way to configure CacheBox as it is very portable. However, you can also configure CacheBox by calling methods on the CacheBoxConfig object, which is exactly what we do when we read the CacheBox DSL.

Below are the main methods used for configuring CacheBox which match exactly to the DSL items, so please refer to the DSL items for definitions and settings. Also, for all the methods in this object, check out the

  • init([any CFCConfig], [string CFCConfigPath])

The constructor

  • cache(string name, [string provider=], [struct properties={}])

Add a new cache configuration

  • defaultCache([numeric objectDefaultTimeout=], [numeric objectDefaultLastAccessTimeout=], [numeric reapFrequency=], [numeric maxObjects=], [numeric freeMemoryPercentageThreshold=], [boolean useLastAccessTimeouts=], [string evictionPolicy=], [numeric evictCount=], [string objectStore=], [boolean coldboxEnabled=])

Add a default cache configuration

  • listener(string class, [struct properties={}], [string name=])

Add a new listener configuration

  • logBoxConfig(string config)

Set the logBox Configuration path to use

  • reset()

Reset the entire configuration

  • scopeRegistration([boolean enabled='false'], [string scope='application'], [string key='cachebox'])

Use to define cachebox factory scope registration

Code Examples:

config = new cacheBox.system.cache.config.CacheBoxConfig();

// logbox config & scope chained, yes you can chain any method
config.logBoxConfig( "LogBox" )
    .scopeRegistration( true, "application", "cacheBox" );

// default cache
config.default( maxObjects=500, evictCount=5, objectDefaultTimeout=30 );

// Caches
config.cache( "ehCache", "caches.ehCacheProvider", {configFile="ehCache.xml"} ).
    cache( "template", "cachebox.system.cache.providers.CacheBoxProvider" );

// Listeners
config.listener( "myapp.model.MyListener", "FunkyListener", {} );
API Docs