coldbox.system.cache

Interface ICacheProvider

coldbox.system.cache.ICacheProvider
Class Attributes:
None
All Known Implementing Classes:
CacheBoxColdBoxProvider , CacheBoxProvider , CFColdBoxProvider , CFProvider , RailoColdboxProvider , RailoProvider

The main interface for a CacheBox cache provider object, you implement it so CacheBox can manage it for you.

Method Summary
any<boolean> clear(any objectKey)
     Clears an object from the cache by using its cache key.
void clearAll()
     Clear all the cache elements from the cache.
any<boolean> clearQuiet(any objectKey)
     Clears an object from the cache by using its cache key.
void clearStatistics()
     Clear the cache statistics.
void configure()
     This method makes the cache ready to accept elements and run.
void expireAll()
     Expire all the elments in the cache (if supported by the provider).
void 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.
any<struct> getCachedObjectMetadata(any objectKey)
     Get a cache objects metadata about its performance.
any<CacheFactory> getCacheFactory()
     Get the cache factory reference this cache provider belongs to.
any<struct> getConfiguration()
     Get the structure of configuration parameters for the cache.
any getEventManager()
     Get this cache managers event listener manager.
any<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<IObjectStore> getObjectStore()
     If the cache provider implements it, this returns the cache's object store as type: coldbox.
any getQuiet(any objectKey)
     Get an object from the cache without updating stats or listners.
any<numeric> getSize()
     Get the number of elements in the cache.
any<ICacheStats> getStats()
     Get the cache statistics object as coldbox.
any<struct> getStoreMetadataKeyMap()
     Get a key lookup structure where cachebox can build the report on.
any<struct> getStoreMetadataReport()
     Get a structure of all the keys in the cache with their appropriate metadata structures.
any<Boolean> isEnabled()
     Returns a flag indicating if the cache is ready for operation.
any<boolean> isExpired(any objectKey)
     Has the object key expired in the cache.
any<Boolean> isReportingEnabled()
     Returns a flag indicating if the cache has reporting enabled.
any<struct> lookup(any objectKey)
     Check if an object is in cache, if not found it records a miss.
any<struct> lookupQuiet(any objectKey)
     Check if an object is in cache, no stats updated or listeners.
void reap()
     Send a reap or flush command to the cache.
any<struct> set(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any<struct> extra])
     sets an object in cache and returns true if set correctly, else false.
void setCacheFactory(any<CacheFactory> cacheFactory)
     Set the cache factory reference for this cache.
void setConfiguration(any<struct> configuration)
     Set the entire configuration structure for this cache.
void setEventManager(any eventManager)
     Set the event manager for this cache.
void setName(any name)
     Set the cache name.
any<struct> setQuiet(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any<struct> extra])
     sets an object in cache and returns true if set correctly, else false.
void shutdown()
     Shutdown command issued when CacheBox is going through shutdown phase.

Method Detail

clear

public any<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 void clearAll()

Clear all the cache elements from the cache


clearQuiet

public any<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 void clearStatistics()

Clear the cache statistics


configure

public void configure()

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


expireAll

public void expireAll()

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


expireObject

public void 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

get

public any get(any objectKey)

Get an object from the cache and updates stats

Parameters:
objectKey - The object key

getCachedObjectMetadata

public any<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 of the object to lookup its metadata

getCacheFactory

public any<CacheFactory> getCacheFactory()

Get the cache factory reference this cache provider belongs to


getConfiguration

public any<struct> getConfiguration()

Get the structure of configuration parameters for the cache


getEventManager

public any getEventManager()

Get this cache managers event listener manager


getKeys

public any<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<IObjectStore> getObjectStore()

If the cache provider implements it, this returns the cache's object store as type: coldbox.system.cache.store.IObjectStore


getQuiet

public any getQuiet(any objectKey)

Get an object from the cache without updating stats or listners

Parameters:
objectKey - The object key

getSize

public any<numeric> getSize()

Get the number of elements in the cache


getStats

public any<ICacheStats> getStats()

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


getStoreMetadataKeyMap

public any<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 any<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 any<Boolean> isEnabled()

Returns a flag indicating if the cache is ready for operation


isExpired

public any<boolean> isExpired(any objectKey)

Has the object key expired in the cache

Parameters:
objectKey - The object key

isReportingEnabled

public any<Boolean> isReportingEnabled()

Returns a flag indicating if the cache has reporting enabled


lookup

public any<struct> lookup(any objectKey)

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

Parameters:
objectKey - The key of the object to lookup.

lookupQuiet

public any<struct> lookupQuiet(any objectKey)

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

Parameters:
objectKey - The key of the object to lookup.

reap

public void reap()

Send a reap or flush command to the cache


set

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

sets an object in cache and returns true if set correctly, else false.

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

setCacheFactory

public void setCacheFactory(any<CacheFactory> cacheFactory)

Set the cache factory reference for this cache

Parameters:
cacheFactory

setConfiguration

public void setConfiguration(any<struct> configuration)

Set the entire configuration structure for this cache

Parameters:
configuration - The configuration structure

setEventManager

public void setEventManager(any eventManager)

Set the event manager for this cache

Parameters:
eventManager - The event manager class

setName

public void setName(any name)

Set the cache name

Parameters:
name - The cache name

setQuiet

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

sets an object in cache and returns true if set correctly, else false. With no statistic updates or listener updates

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

shutdown

public void shutdown()

Shutdown command issued when CacheBox is going through shutdown phase