coldbox.system.cache.store

Class ConcurrentSoftReferenceStore

lucee.Component
    extended by coldbox.system.cache.store.ConcurrentStore
      extended by coldbox.system.cache.store.ConcurrentSoftReferenceStore
All Implemented Interfaces:
IObjectStore

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- I am a concurrent soft reference object store. In other words, I am fancy! This store is case-sensitive

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Luis Majano
  •  
    Property Summary
    type property default serializable required
    any referenceQueue
          The Java soft reference queue used for reaps.

    • access = public
    • returntype = any
    true false
    any softRefKeymap
          The reverse lookup map for soft references.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(any<ICacheProvider> cacheProvider)
          Constructor.
    Method Summary
    any clear(any objectKey)
         Clears an object from the storage pool.
    void clearAll()
         Clear all the elements in the store.
    private any createSoftReference(any objectKey, any target)
         Create SR, register cached object and reference.
    any get(any objectKey)
         Get an object from cache.
    any getQuiet(any objectKey)
         Get an object from cache.
    string getReferenceQueue()
    any getSoftRefKey(any softRef)
         Get the soft reference's key from the soft reference lookback map.
    string getSoftRefKeymap()
    any lookup(any objectKey)
         Check if an object is in cache.
    void reap()
         Reap the storage, clean it from old stuff.
    void set(any objectKey, any object, [any timeout=''], [any lastAccessTimeout=''], [any extras='[runtime expression]'])
         Sets an object in the storage.
    any setReferenceQueue(any referenceQueue)
    any setSoftRefKeymap(any softRefKeymap)
    boolean softRefLookup(any softRef)
         See if the soft reference is in the reference key map.
     
    Methods inherited from class coldbox.system.cache.store.ConcurrentStore
    expireObject, flush, getCacheProvider, getIndexer, getKeys, getPool, getSize, getStoreID, isExpired, setCacheProvider, setIndexer, setPool, setStoreID
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(any<ICacheProvider> cacheProvider)

    Constructor

    Parameters:
    cacheProvider - The associated cache provider as coldbox.system.cache.providers.ICacheProvider

    Property Detail

    referenceQueue

    property any referenceQueue

    The Java soft reference queue used for reaps

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    softRefKeymap

    property any softRefKeymap

    The reverse lookup map for soft references

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    clear

    public any clear(any objectKey)

    Clears an object from the storage pool

    Overrides:
    clear in class ConcurrentStore
    Parameters:
    objectKey - The object key to clear

    clearAll

    public void clearAll()

    Clear all the elements in the store

    Overrides:
    clearAll in class ConcurrentStore

    createSoftReference

    private any createSoftReference(any objectKey, any target)

    Create SR, register cached object and reference

    Parameters:
    objectKey - The value of the key to store
    target - The target to wrap
    Returns:
    A java soft reference `java.lang.ref.SoftReference`

    get

    public any get(any objectKey)

    Get an object from cache. If its a soft reference object it might return a `null` value.

    Overrides:
    get in class ConcurrentStore
    Parameters:
    objectKey - The key to retrieve

    getQuiet

    public any getQuiet(any objectKey)

    Get an object from cache. If its a soft reference object it might return a null value

    Overrides:
    getQuiet in class ConcurrentStore
    Parameters:
    objectKey - The key to retrieve

    getReferenceQueue

    public string getReferenceQueue()


    getSoftRefKey

    public any getSoftRefKey(any softRef)

    Get the soft reference's key from the soft reference lookback map

    Parameters:
    softRef - The soft reference to check
    Returns:
    The object key it points to

    getSoftRefKeymap

    public string getSoftRefKeymap()


    lookup

    public any lookup(any objectKey)

    Check if an object is in cache

    Overrides:
    lookup in class ConcurrentStore
    Parameters:
    objectKey - The key to lookup
    Returns:
    boolean

    reap

    public void reap()

    Reap the storage, clean it from old stuff

    Overrides:
    reap in class ConcurrentStore

    set

    public void set(any objectKey, any object, [any timeout=''], [any lastAccessTimeout=''], [any extras='[runtime expression]'])

    Sets an object in the storage

    Overrides:
    set in class ConcurrentStore
    Parameters:
    objectKey - The object key"
    object - The object to save"
    timeout - Timeout in minutes"
    lastAccessTimeout - Idle Timeout in minutes"
    extras - A map of extra name-value pairs"

    setReferenceQueue

    public any setReferenceQueue(any referenceQueue)

    Parameters:
    referenceQueue

    setSoftRefKeymap

    public any setSoftRefKeymap(any softRefKeymap)

    Parameters:
    softRefKeymap

    softRefLookup

    public boolean softRefLookup(any softRef)

    See if the soft reference is in the reference key map

    Parameters:
    softRef - The soft reference to verify