org.wso2.carbon.registry.core.jdbc.dao
Class PathCache

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dao.PathCache

public class PathCache
extends Object

Implementation of caching for resource paths. This is based on Cache.


Method Summary
 int addEntry(String path, int parentPathId)
          Method to add resource path entry to the database.
static PathCache createPathCache(int maxElementsInMemory, boolean eternal, long timeToLiveSeconds)
          Creates a object storing a set of cached paths.
static PathCache getPathCache()
          Method to obtain the created path cache instance.
 int getPathID(Connection conn, String path)
          Method to get the path id of a given path.
 double hitRate()
          Method to get the cache hit rate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createPathCache

public static PathCache createPathCache(int maxElementsInMemory,
                                        boolean eternal,
                                        long timeToLiveSeconds)
Creates a object storing a set of cached paths.

Parameters:
maxElementsInMemory - maximum number of cached elements in memory.
eternal - whether the elements in the cache are eternal, i.e. never expire
timeToLiveSeconds - the default amount of time to live for an element from its creation date
Returns:
the cache object created
See Also:
Cache

getPathCache

public static PathCache getPathCache()
Method to obtain the created path cache instance.

Returns:
the created path cache instance

hitRate

public double hitRate()
Method to get the cache hit rate.

Returns:
the cache hit rate.

addEntry

public int addEntry(String path,
                    int parentPathId)
             throws SQLException
Method to add resource path entry to the database.

Parameters:
path - the path to add.
parentPathId - the parent path's id.
Returns:
the path's id.
Throws:
SQLException - if an error occurs while adding the entry.

getPathID

public int getPathID(Connection conn,
                     String path)
              throws SQLException
Method to get the path id of a given path.

Parameters:
conn - the database connection to use.
path - the path.
Returns:
the path id corresponding to the given path.
Throws:
SQLException - if an error occurs while obtaining the path id.


Copyright © 2010. All Rights Reserved.