coldbox.system.cache.providers

Interface ICacheProvider

coldbox.system.cache.providers.ICacheProvider
All Known Implementing Classes:
CFColdBoxProvider , CFProvider , CacheBoxColdBoxProvider , CacheBoxProvider , LuceeColdboxProvider , LuceeProvider
All Known Subinterfaces:
IColdBoxProvider

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- The main interface for a CacheBox cache provider. You need to implement all the methods in order for CacheBox to work correctly for the implementing cache provider. Many of the methods return itself, so they are documented in the

@return
annotation since interfaces are very janky in acf11 and 2016

Class Attributes:
  • author : Luis Majano
  •  
    Method Summary
    boolean clear(any objectKey)
         Clears an object from the cache by using its cache key.
    any clearAll()
         Clear all the cache elements from the cache.
    boolean clearQuiet(any objectKey)
         Clears an object from the cache by using its cache key.
    any clearStatistics()
         Clear the cache statistics.
    any configure()
         This method makes the cache ready to accept elements and run.
    any expireAll()
         Expire all the elements in the cache (if supported by the provider).
    any expireObject(any objectKey)
         Expires an object from the cache by using its cache key.
    any get(any objectKey)
         Get an object from the cache and updates stats.
    CacheFactory getCacheFactory()
         Get the cache factory reference this cache provider belongs to.
    struct getCachedObjectMetadata(any objectKey)
         Get a cache objects metadata about its performance.
    struct getConfiguration()
         Get the structure of configuration parameters for the cache.
    any getEventManager()
         Get this cache managers event listener manager.
    array getKeys()
         Returns a list of all elements in the cache, whether or not they are expired.
    any getName()
         Get the name of this cache.
    any getObjectStore()
         If the cache provider implements it, this returns the cache's object store.
    any getQuiet(any objectKey)
         Get an object from the cache without updating stats or listeners.
    numeric getSize()
         Get the number of elements in the cache.
    any getStats()
         Get the cache statistics object as coldbox.
    struct getStoreMetadataKeyMap()
         Get a key lookup structure where cachebox can build the report on.
    struct getStoreMetadataReport()
         Get a structure of all the keys in the cache with their appropriate metadata structures.
    boolean isEnabled()
         Returns a flag indicating if the cache is ready for operation.
    boolean isExpired(any objectKey)
         Has the object key expired in the cache.
    boolean isReportingEnabled()
         Returns a flag indicating if the cache has reporting enabled.
    boolean lookup(any objectKey)
         Check if an object is in cache, if not found it records a miss.
    boolean lookupQuiet(any objectKey)
         Check if an object is in cache, no stats updated or listeners.
    any reap()
         Send a reap or flush command to the cache.
    any set(any objectKey, any object, [any timeout], [any lastAccessTimeout], [struct extra])
         Sets an object in the cache and returns an instance of itself.
    any setCacheFactory(any<CacheFactory> cacheFactory)
         Set the cache factory reference for this cache.
    any setConfiguration(struct configuration)
         Set the entire configuration structure for this cache.
    any setEventManager(any eventManager)
         Set the event manager for this cache.
    any setName(any name)
         Set the cache name.
    any setQuiet(any objectKey, any object, [any timeout], [any lastAccessTimeout], [struct extra])
         Sets an object in the cache with no event calls and returns an instance of itself.
    any shutdown()
         Shutdown command issued when CacheBox is going through shutdown phase.

    Method Detail

    clear

    public boolean clear(any objectKey)

    Clears an object from the cache by using its cache key. Returns false if object was not removed or did not exist anymore

    Parameters:
    objectKey - The object cache key

    clearAll

    public any clearAll()

    Clear all the cache elements from the cache

    Returns:
    ICacheProvider

    clearQuiet

    public boolean clearQuiet(any objectKey)

    Clears an object from the cache by using its cache key. Returns false if object was not removed or did not exist anymore without doing statistics or updating listeners

    Parameters:
    objectKey - The object cache key

    clearStatistics

    public any clearStatistics()

    Clear the cache statistics

    Returns:
    ICacheProvider

    configure

    public any configure()

    This method makes the cache ready to accept elements and run. Usually a cache is first created (init), then wired and then the factory calls configure() on it

    Returns:
    ICacheProvider

    expireAll

    public any expireAll()

    Expire all the elements in the cache (if supported by the provider)

    Returns:
    ICacheProvider

    expireObject

    public any expireObject(any objectKey)

    Expires an object from the cache by using its cache key. Returns false if object was not removed or did not exist anymore (if supported by the provider)

    Parameters:
    objectKey - The object cache key
    Returns:
    ICacheProvider

    get

    public any get(any objectKey)

    Get an object from the cache and updates stats

    Parameters:
    objectKey - The key to retrieve

    getCacheFactory

    public CacheFactory getCacheFactory()

    Get the cache factory reference this cache provider belongs to


    getCachedObjectMetadata

    public struct getCachedObjectMetadata(any objectKey)

    Get a cache objects metadata about its performance. This value is a structure of name-value pairs of metadata.

    Parameters:
    objectKey - The key to retrieve

    getConfiguration

    public struct getConfiguration()

    Get the structure of configuration parameters for the cache


    getEventManager

    public any getEventManager()

    Get this cache managers event listener manager


    getKeys

    public array getKeys()

    Returns a list of all elements in the cache, whether or not they are expired


    getName

    public any getName()

    Get the name of this cache


    getObjectStore

    public any getObjectStore()

    If the cache provider implements it, this returns the cache's object store.

    Returns:
    coldbox.system.cache.store.IObjectStore or any depending on the cache implementation

    getQuiet

    public any getQuiet(any objectKey)

    Get an object from the cache without updating stats or listeners

    Parameters:
    objectKey - The key to retrieve

    getSize

    public numeric getSize()

    Get the number of elements in the cache


    getStats

    public any getStats()

    Get the cache statistics object as coldbox.system.cache.util.IStats

    Returns:
    coldbox.system.cache.util.IStats

    getStoreMetadataKeyMap

    public struct getStoreMetadataKeyMap()

    Get a key lookup structure where cachebox can build the report on. Ex: [timeout=timeout,lastAccessTimeout=idleTimeout]. It is a way for the visualizer to construct the columns correctly on the reports


    getStoreMetadataReport

    public struct getStoreMetadataReport()

    Get a structure of all the keys in the cache with their appropriate metadata structures. This is used to build the reporting.[keyX->[metadataStructure]]


    isEnabled

    public boolean isEnabled()

    Returns a flag indicating if the cache is ready for operation


    isExpired

    public boolean isExpired(any objectKey)

    Has the object key expired in the cache

    Parameters:
    objectKey - The key to retrieve

    isReportingEnabled

    public boolean isReportingEnabled()

    Returns a flag indicating if the cache has reporting enabled


    lookup

    public boolean lookup(any objectKey)

    Check if an object is in cache, if not found it records a miss.

    Parameters:
    objectKey - The key to retrieve

    lookupQuiet

    public boolean lookupQuiet(any objectKey)

    Check if an object is in cache, no stats updated or listeners

    Parameters:
    objectKey - The key to retrieve

    reap

    public any reap()

    Send a reap or flush command to the cache

    Returns:
    ICacheProvider

    set

    public any set(any objectKey, any object, [any timeout], [any lastAccessTimeout], [struct extra])

    Sets an object in the cache and returns an instance of itself

    Parameters:
    objectKey - The object cache key
    object - The object to cache
    timeout - The timeout to use on the object (if any, provider specific)
    lastAccessTimeout - The idle timeout to use on the object (if any, provider specific)
    extra - A map of name-value pairs to use as extra arguments to pass to a providers set operation
    Returns:
    ICacheProvider

    setCacheFactory

    public any setCacheFactory(any<CacheFactory> cacheFactory)

    Set the cache factory reference for this cache

    Parameters:
    cacheFactory - The cache factory
    Returns:
    ICacheProvider

    setConfiguration

    public any setConfiguration(struct configuration)

    Set the entire configuration structure for this cache

    Parameters:
    configuration - The cache configuration
    Returns:
    ICacheProvider

    setEventManager

    public any setEventManager(any eventManager)

    Set the event manager for this cache

    Parameters:
    eventManager - The event manager to set
    Returns:
    ICacheProvider

    setName

    public any setName(any name)

    Set the cache name

    Parameters:
    name - The name to set
    Returns:
    ICacheProvider

    setQuiet

    public any setQuiet(any objectKey, any object, [any timeout], [any lastAccessTimeout], [struct extra])

    Sets an object in the cache with no event calls and returns an instance of itself

    Parameters:
    objectKey - The object cache key
    object - The object to cache
    timeout - The timeout to use on the object (if any, provider specific)
    lastAccessTimeout - The idle timeout to use on the object (if any, provider specific)
    extra - A map of name-value pairs to use as extra arguments to pass to a providers set operation
    Returns:
    ICacheProvider

    shutdown

    public any shutdown()

    Shutdown command issued when CacheBox is going through shutdown phase

    Returns:
    ICacheProvider