JDBCQueryCache (Hyperic HQ Plugin API)
Keywords: org.hyperic.hq.product.JDBCQueryCache class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.hq.product
Class JDBCQueryCache

    java.lang.Object
      org.hyperic.hq.product.JDBCQueryCache

    public class JDBCQueryCache

extends java.lang.Object

JDBCQueryCache is a simple caching mechanism to be used with JDBCMeasurementPlugins. example: mysql> select Value, Default from sys_table; +-----------------------------------+----------+---------+ | Variable_name | Value | Default | +-----------------------------------+----------+---------+ | DB_Max_Memory | 8192 | 1024 | | DB_Max_Connections | 400 | 10 | ... ... `String query = "select Value, Default from sys_table"; JDBCQueryCache cache = new JDBCQueryCache(query, "Variable_name", 5000); Double val = Double.valueOf(cache.get("DB_Max_Memory", "Value").toString()); val = Double.valueOf(cache.get("DB_Max_Connections", "Default").toString());`

Constructor Summary
`JDBCQueryCache(java.lang.String query, java.lang.String queryKey, long cacheTimeout)`

Method Summary
`void` | `clearCache()` Explicitly clears any cached value
`java.lang.Object` | `get(java.sql.Connection conn, java.lang.String key, java.lang.String column)`
`java.lang.Object` | `getOnlyRow(java.sql.Connection conn, java.lang.String column)`
`void` | `setExpireTime(long expireTime)` Explicitly sets the expire time of the cache to expireTime.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JDBCQueryCache

    public JDBCQueryCache(java.lang.String query,
                          java.lang.String queryKey,
                          long cacheTimeout)

Method Detail

### clearCache

    public void clearCache()

  Explicitly clears any cached value

### setExpireTime

    public void setExpireTime(long expireTime)

  Explicitly sets the expire time of the cache to expireTime. Cache will not repopulate until System.currentTimeMillis() <= expireTime.

### getOnlyRow

    public java.lang.Object getOnlyRow(java.sql.Connection conn,
                                       java.lang.String column)
                                throws java.sql.SQLException,
                                       JDBCQueryCacheException

  Returns:
    Object representation of the *only* row and column value or null if it does not exist
  Throws:
    `JDBCQueryCacheException` - if there are 0 or > 1 rows in the cache.
    `java.sql.SQLException`

### get

    public java.lang.Object get(java.sql.Connection conn,
                                java.lang.String key,
                                java.lang.String column)
                         throws JDBCQueryCacheException,
                                java.sql.SQLException

  Returns:
    Object representation of the row key/column value or null if it does not exist
  Throws:
    `JDBCQueryCacheException`
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.