cachebox.system.cache

Interface ICacheProvider

cachebox.system.cache.ICacheProvider
All Known Implementing Classes:
CacheBoxColdBoxProvider , CacheBoxProvider , CFColdBoxProvider , CFProvider , LuceeColdboxProvider , LuceeProvider
All Known Subinterfaces:
IColdboxApplicationCache

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

Class Attributes:
None
Method Summary
any 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 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 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 getConfiguration()
     Get the structure of configuration parameters for the cache.
any getEventManager()
     Get this cache managers event listener manager.
any 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: cachebox.
any getQuiet(any objectKey)
     Get an object from the cache without updating stats or listners.
any getSize()
     Get the number of elements in the cache.
any<ICacheStats> getStats()
     Get the cache statistics object as cachebox.
any getStoreMetadataKeyMap()
     Get a key lookup structure where cachebox can build the report on.
any getStoreMetadataReport()
     Get a structure of all the keys in the cache with their appropriate metadata structures.
any isEnabled()
     Returns a flag indicating if the cache is ready for operation.
any isExpired(any objectKey)
     Has the object key expired in the cache.
any isReportingEnabled()
     Returns a flag indicating if the cache has reporting enabled.
any lookup(any objectKey)
     Check if an object is in cache, if not found it records a miss.
any 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 set(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any 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 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 setQuiet(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any 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 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 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 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 getConfiguration()

Get the structure of configuration parameters for the cache


getEventManager

public any getEventManager()

Get this cache managers event listener manager


getKeys

public any 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: cachebox.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 getSize()

Get the number of elements in the cache


getStats

public any<ICacheStats> getStats()

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


getStoreMetadataKeyMap

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

Returns a flag indicating if the cache is ready for operation


isExpired

public any isExpired(any objectKey)

Has the object key expired in the cache

Parameters:
objectKey - The object key

isReportingEnabled

public any isReportingEnabled()

Returns a flag indicating if the cache has reporting enabled


lookup

public any 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 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 set(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any 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 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 setQuiet(any objectKey, any object, [any timeout], [any lastAccessTimeout], [any 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