coldbox.system.cache.store

Class JDBCStore

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

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- I am a cool cool JDBC Store for CacheBox You need to create the table first with the following columns id - varchar(100) PK objectKey - varchar(255) objectValue - clob, longtext, etc hits - integer timeout - integer lastAccessTimeout - integer created - datetime or timestamp lastAccessed - datetime or timestamp isExpired - tinyint or boolean isSimple - tinyint or boolean We also recommend indexes for: hits, created, lastAccessed, timeout and isExpired columns. Or look in the /coldbox/system/cache/store/sql/*.sql for you sql script for your DB.

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Luis Majano
  •  
    Property Summary
    type property default serializable required
    any<ICacheProvider> cacheProvider
          The cache provider reference.

    • access = public
    • returntype = any
    • doc_generic = coldbox.system.cache.providers.ICacheProvider
    true false
    any<ObjectMarshaller> converter
          The object serializer and deserializer utility.

    • access = public
    • returntype = any
    • doc_generic = coldbox.system.core.conversion.ObjectMarshaller
    true false
    any dsn
          The datasource to use for the connection.

    • access = public
    • returntype = any
    true false
    any dsnPassword
          The password to use for the connection, if any.

    • access = public
    • returntype = any
    true false
    any dsnUsername
          The username to use for the connection, if any.

    • access = public
    • returntype = any
    true false
    any<MetadataIndexer> indexer
          The metadata indexer object.

    • access = public
    • returntype = any
    • doc_generic = coldbox.system.cache.store.indexers.MetadataIndexer
    true false
    boolean queryIncludeDsn
          Whether to include the DSN in queryExecute statements.

    • access = public
    • returntype = any
    true true false
    any storeID
          The human store name.

    • access = public
    • returntype = any
    true false
    any table
          The table to use for storage.

    • access = public
    • returntype = any
    true false
    boolean tableAutoCreate
          Auto create the table or just use it.

    • access = public
    • returntype = any
    true true false
    Constructor Summary
    init(any<ICacheProvider> cacheProvider)
          Constructor.
    Method Summary
    any clear(any objectKey)
         Clears an object from the storage.
    void clearAll()
         Clear all the elements in the store.
    private any ensureTable()
         Create the caching table if necessary.
    void expireObject(any objectKey)
         Expire an object.
    void flush()
         Flush the store to a permanent storage.
    any get(any objectKey)
         Get an object from the store with metadata tracking, or null if not found.
    string getCacheProvider()
    string getConverter()
    string getDsn()
    string getDsnPassword()
    string getDsnUsername()
    any getIndexer()
         Get the store's pool metadata indexer structure.
    any getKeys()
         Get all the store's object keys array.
    any getNormalizedId(any objectKey)
         Get the cached normalized id as we store it.
    string getQueryIncludeDsn()
    any getQuiet(any objectKey)
         Get an object from cache with no metadata tracking.
    any getSize()
         Get the size of the store.
    string getStoreID()
    string getTable()
    string getTableAutoCreate()
    any isExpired(any objectKey)
         Expire check.
    any lookup(any objectKey)
         Check if an object is in the store.
    private query lookupQuery(any objectKey)
         Get the id and isExpired from the object.
    void reap()
         Reap the storage.
    void set(any objectKey, any object, [any timeout='0'], [any lastAccessTimeout='0'], [any extras='[runtime expression]'])
         Sets an object in the storage.
    any setCacheProvider(any cacheProvider)
    any setConverter(any converter)
    any setDsn(any dsn)
    any setDsnPassword(any dsnPassword)
    any setDsnUsername(any dsnUsername)
    any setIndexer(any indexer)
    any setQueryIncludeDsn(boolean queryIncludeDsn)
    any setStoreID(any storeID)
    any setTable(any table)
    any setTableAutoCreate(boolean tableAutoCreate)
     
    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

    cacheProvider

    property any<ICacheProvider> cacheProvider

    The cache provider reference

    Attributes:
    access - public
    required - false
    returntype - any
    doc_generic - coldbox.system.cache.providers.ICacheProvider
    serializable - true

    converter

    property any<ObjectMarshaller> converter

    The object serializer and deserializer utility

    Attributes:
    access - public
    required - false
    returntype - any
    doc_generic - coldbox.system.core.conversion.ObjectMarshaller
    serializable - true

    dsn

    property any dsn

    The datasource to use for the connection

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

    dsnPassword

    property any dsnPassword

    The password to use for the connection, if any

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

    dsnUsername

    property any dsnUsername

    The username to use for the connection, if any

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

    indexer

    property any<MetadataIndexer> indexer

    The metadata indexer object

    Attributes:
    access - public
    required - false
    returntype - any
    doc_generic - coldbox.system.cache.store.indexers.MetadataIndexer
    serializable - true

    queryIncludeDsn

    property boolean queryIncludeDsn = [true]

    Whether to include the DSN in queryExecute statements. If not, it will use the default set in applciation.cfc

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

    storeID

    property any storeID

    The human store name

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

    table

    property any table

    The table to use for storage

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

    tableAutoCreate

    property boolean tableAutoCreate = [true]

    Auto create the table or just use it

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

    Method Detail

    clear

    public any clear(any objectKey)

    Clears an object from the storage

    Specified by:
    clear in interface IObjectStore
    Parameters:
    objectKey - The object key to clear

    clearAll

    public void clearAll()

    Clear all the elements in the store

    Specified by:
    clearAll in interface IObjectStore

    ensureTable

    private any ensureTable()

    Create the caching table if necessary


    expireObject

    public void expireObject(any objectKey)

    Expire an object

    Specified by:
    expireObject in interface IObjectStore
    Parameters:
    objectKey - The key to expire

    flush

    public void flush()

    Flush the store to a permanent storage

    Specified by:
    flush in interface IObjectStore

    get

    public any get(any objectKey)

    Get an object from the store with metadata tracking, or null if not found

    Specified by:
    get in interface IObjectStore
    Parameters:
    objectKey - The key to retrieve

    getCacheProvider

    public string getCacheProvider()


    getConverter

    public string getConverter()


    getDsn

    public string getDsn()


    getDsnPassword

    public string getDsnPassword()


    getDsnUsername

    public string getDsnUsername()


    getIndexer

    public any getIndexer()

    Get the store's pool metadata indexer structure

    Specified by:
    getIndexer in interface IObjectStore
    Returns:
    coldbox.system.cache.store.indexers.MetadataIndexer

    getKeys

    public any getKeys()

    Get all the store's object keys array

    Specified by:
    getKeys in interface IObjectStore
    Returns:
    array

    getNormalizedId

    public any getNormalizedId(any objectKey)

    Get the cached normalized id as we store it

    Parameters:
    objectKey - The object key

    getQueryIncludeDsn

    public string getQueryIncludeDsn()


    getQuiet

    public any getQuiet(any objectKey)

    Get an object from cache with no metadata tracking

    Specified by:
    getQuiet in interface IObjectStore
    Parameters:
    objectKey - The key to retrieve

    getSize

    public any getSize()

    Get the size of the store

    Specified by:
    getSize in interface IObjectStore

    getStoreID

    public string getStoreID()


    getTable

    public string getTable()


    getTableAutoCreate

    public string getTableAutoCreate()


    isExpired

    public any isExpired(any objectKey)

    Expire check

    Specified by:
    isExpired in interface IObjectStore
    Parameters:
    objectKey - The key to check
    Returns:
    boolean

    lookup

    public any lookup(any objectKey)

    Check if an object is in the store

    Specified by:
    lookup in interface IObjectStore
    Parameters:
    objectKey - The key to lookup
    Returns:
    boolean

    lookupQuery

    private query lookupQuery(any objectKey)

    Get the id and isExpired from the object

    Parameters:
    objectKey - The key of the object

    reap

    public void reap()

    Reap the storage

    Specified by:
    reap in interface IObjectStore

    set

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

    Sets an object in the storage

    Specified by:
    set in interface IObjectStore
    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 to store alongside the object

    setCacheProvider

    public any setCacheProvider(any cacheProvider)

    Parameters:
    cacheProvider

    setConverter

    public any setConverter(any converter)

    Parameters:
    converter

    setDsn

    public any setDsn(any dsn)

    Parameters:
    dsn

    setDsnPassword

    public any setDsnPassword(any dsnPassword)

    Parameters:
    dsnPassword

    setDsnUsername

    public any setDsnUsername(any dsnUsername)

    Parameters:
    dsnUsername

    setIndexer

    public any setIndexer(any indexer)

    Parameters:
    indexer

    setQueryIncludeDsn

    public any setQueryIncludeDsn(boolean queryIncludeDsn)

    Parameters:
    queryIncludeDsn

    setStoreID

    public any setStoreID(any storeID)

    Parameters:
    storeID

    setTable

    public any setTable(any table)

    Parameters:
    table

    setTableAutoCreate

    public any setTableAutoCreate(boolean tableAutoCreate)

    Parameters:
    tableAutoCreate