coldbox.system.cache

Class CacheFactory

railo-context.Component
        extended by coldbox.system.cache.CacheFactory
Class Attributes:
  • output : false
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
  • serializable : false
  •  

    The ColdBox CacheBox Factory

    Constructor Summary
    init([any<CacheBoxConfig> config], [any<Controller> coldbox], [any factoryID=''])
          Constructor.
    Method Summary
    void addCache(any<ICacheProvider> cache)
         Register a new instantiated cache with this cache factory.
    any<ICacheProvider> addDefaultCache(any name)
         Add a default named cache to our registry, create it, config it, register it and return it of type: coldbox.
    any<Boolean> cacheExists(any name)
         Check if the passed in named cache is already registered in this factory or not.
    void clearAll()
         Clears all the elements in all the registered caches without de-registrations.
    void configure(any<CacheBoxConfig> config)
         Configure the cache factory for operation, called by the init().
    private void configureEventManager()
         Configure a standalone version of a ColdBox Event Manager.
    private void configureLogBox()
         Configure a standalone version of logBox for logging.
    any<ICacheProvider> createCache(any name, any provider, [any<struct> properties='[runtime expression]'])
         Create a new cache according the the arguments, register it and return it of type: coldbox.
    private void doScopeRegistration()
         Register this cachefactory on a user specified scope.
    void expireAll()
         Expires all the elements in all the registered caches without de-registrations.
    any<ICacheProvider> getCache(any name)
         Get a reference to a registered cache in this factory.
    any<array> getCacheNames()
         Get the array of caches registered with this factory.
    any<Struct> getCaches()
         Get a reference to all the registered caches in the cache factory as a structure.
    any<Controller> getColdbox()
         Get the instance of ColdBox linked in this cache factory.
    any<CacheBoxConfig> getConfig()
         Get this LogBox's configuration object.
    any<ICacheProvider> getDefaultCache()
         Get the default cache provider of type coldbox.
    any getEventManager()
         Get the cache factory's event manager.
    any getFactoryID()
         Get the unique ID of this cache factory.
    any<LogBox> getLogBox()
         Get the instance of LogBox configured for this cache factory.
    any<struct> getScopeRegistration()
         Get the scope registration information.
    private any<Util> getUtil()
         Create and return a util object.
    any getVersion()
         Get the CacheBox version string.
    any<Boolean> isColdBoxLinked()
         Checks if Coldbox application controller is linked.
    void reapAll()
         A nice way to call reap on all registered caches.
    private void registerCache(any<ICacheProvider> cache)
         Register a cache instance internaly.
    private void registerListeners()
         Register all the configured listeners in the configuration file.
    void removeAll()
         Remove all the registered caches in this factory, this triggers individual cache shutdowns.
    any<Boolean> removeCache(any name)
         Try to remove a named cache from this factory, returns Boolean if successfull or not.
    void removeFromScope()
         Remove the cache factory from scope registration if enabled, else does nothing.
    void replaceCache(any<ICacheProvider> cache, any<ICacheProvider> decoratedCache)
         Replace a registered named cache with a new decorated cache of the same name.
    void shutdown()
         Recursively sends shutdown commands to al registered caches and cleans up in preparation for shutdown.
    void shutdownCache(any name)
         Send a shutdown command to a specific cache provider to bring down gracefully.
     
    Methods inherited from class railo-context.Component
    None

    Constructor Detail

    init

    public init([any<CacheBoxConfig> config], [any<Controller> coldbox], [any factoryID=''])

    Constructor

    Parameters:
    config - The CacheBoxConfig object or path to use to configure this instance of CacheBox. If not passed then CacheBox will instantiate the default configuration.
    coldbox - A coldbox application that this instance of CacheBox can be linked to, if not using it, just ignore it.
    factoryID - A unique ID or name for this factory. If not passed I will make one up for you.

    Method Detail

    addCache

    public void addCache(any<ICacheProvider> cache)

    Register a new instantiated cache with this cache factory

    Parameters:
    cache - The cache instance to register with this factory of type: coldbox.system.cache.ICacheProvider

    addDefaultCache

    public any<ICacheProvider> addDefaultCache(any name)

    Add a default named cache to our registry, create it, config it, register it and return it of type: coldbox.system.cache.ICacheProvider

    Parameters:
    name - The name of the default cache to create

    cacheExists

    public any<Boolean> cacheExists(any name)

    Check if the passed in named cache is already registered in this factory or not

    Parameters:
    name - The name of the cache to check

    clearAll

    public void clearAll()

    Clears all the elements in all the registered caches without de-registrations


    configure

    public void configure(any<CacheBoxConfig> config)

    Configure the cache factory for operation, called by the init(). You can also re-configure CacheBox programmatically.

    Parameters:
    config - The CacheBoxConfig object to use to configure this instance of CacheBox

    configureEventManager

    private void configureEventManager()

    Configure a standalone version of a ColdBox Event Manager


    configureLogBox

    private void configureLogBox()

    Configure a standalone version of logBox for logging


    createCache

    public any<ICacheProvider> createCache(any name, any provider, [any<struct> properties='[runtime expression]'])

    Create a new cache according the the arguments, register it and return it of type: coldbox.system.cache.ICacheProvider

    Parameters:
    name - The name of the cache to add
    provider - The provider class path of the cache to add
    properties - The properties of the cache to configure with

    doScopeRegistration

    private void doScopeRegistration()

    Register this cachefactory on a user specified scope


    expireAll

    public void expireAll()

    Expires all the elements in all the registered caches without de-registrations


    getCache

    public any<ICacheProvider> getCache(any name)

    Get a reference to a registered cache in this factory. If the cache does not exist it will return an exception. Type: coldbox.system.cache.ICacheProvider

    Parameters:
    name - The named cache to retrieve

    getCacheNames

    public any<array> getCacheNames()

    Get the array of caches registered with this factory


    getCaches

    public any<Struct> getCaches()

    Get a reference to all the registered caches in the cache factory as a structure


    getColdbox

    public any<Controller> getColdbox()

    Get the instance of ColdBox linked in this cache factory. Empty if using standalone version


    getConfig

    public any<CacheBoxConfig> getConfig()

    Get this LogBox's configuration object.


    getDefaultCache

    public any<ICacheProvider> getDefaultCache()

    Get the default cache provider of type coldbox.system.cache.ICacheProvider


    getEventManager

    public any getEventManager()

    Get the cache factory's event manager


    getFactoryID

    public any getFactoryID()

    Get the unique ID of this cache factory


    getLogBox

    public any<LogBox> getLogBox()

    Get the instance of LogBox configured for this cache factory


    getScopeRegistration

    public any<struct> getScopeRegistration()

    Get the scope registration information


    getUtil

    private any<Util> getUtil()

    Create and return a util object


    getVersion

    public any getVersion()

    Get the CacheBox version string.


    isColdBoxLinked

    public any<Boolean> isColdBoxLinked()

    Checks if Coldbox application controller is linked


    reapAll

    public void reapAll()

    A nice way to call reap on all registered caches


    registerCache

    private void registerCache(any<ICacheProvider> cache)

    Register a cache instance internaly

    Parameters:
    cache - The cache instance to register with this factory of type: coldbox.system.cache.ICacheProvider

    registerListeners

    private void registerListeners()

    Register all the configured listeners in the configuration file


    removeAll

    public void removeAll()

    Remove all the registered caches in this factory, this triggers individual cache shutdowns


    removeCache

    public any<Boolean> removeCache(any name)

    Try to remove a named cache from this factory, returns Boolean if successfull or not

    Parameters:
    name - The name of the cache to remove

    removeFromScope

    public void removeFromScope()

    Remove the cache factory from scope registration if enabled, else does nothing


    replaceCache

    public void replaceCache(any<ICacheProvider> cache, any<ICacheProvider> decoratedCache)

    Replace a registered named cache with a new decorated cache of the same name.

    Parameters:
    cache - The name of the cache to replace or the actual instance of the cache to replace
    decoratedCache - The decorated cache manager instance to replace with of type coldbox.system.cache.ICacheProvider

    shutdown

    public void shutdown()

    Recursively sends shutdown commands to al registered caches and cleans up in preparation for shutdown


    shutdownCache

    public void shutdownCache(any name)

    Send a shutdown command to a specific cache provider to bring down gracefully. It also removes it from the cache factory

    Parameters:
    name - The cache provider name to shutdown