RSEPRCache
Date: 2013-02-16

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gcube.search.rseprcache
Class RSEPRCache

    java.lang.Object
      org.gcube.search.rseprcache.RSEPRCache

    public class RSEPRCache

extends java.lang.Object

This class implements a cache for storing Result Set EPRs that correspond to specific query results. Provides a get method that retrieves a Result Set EPR, when it is given the query that produced the Result Set, as a key. It also provides an add method that adds a pair of query-ResultSet.

Author:
  vasilis verroios

Constructor Summary
`RSEPRCache(GCUBESecurityManager sman, GCUBEScope sc)` Default constructor of RSEPRCache that should be used by gCube components that are not exposed as services.
`RSEPRCache(GCUBEServiceContext sctx)` Default constructor of RSEPRCache that should be used by gCube services.
`RSEPRCache(GCUBEServiceContext sctx, long ttl, long tti, int maxElementsInMemory)` Constructor of RSEPRCache that takes configuration parameters and creates a new cache with this configuration.

Method Summary
`void` | `add(java.lang.Object query, java.lang.String rsEpr)` Adds a pair of query-RS EPR to the given cache
`java.lang.String` | `get(java.lang.Object query)` Retrieves a ResultSet EPR given the query that produced the ResultSet
`int` | `size()` Size of the cache used

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

Constructor Detail

### RSEPRCache

    public RSEPRCache(GCUBESecurityManager sman,
                      GCUBEScope sc)
               throws java.lang.Exception

  Default constructor of RSEPRCache that should be used by gCube components that are not exposed as services. It returns a new RSEPRCache object.

  Parameters:
    `sman` - a security manager that will be used to register to the notifications topic
    `sc` - the infrastructure scope of this scope will be used for subscribing to the topic
  Throws:
    `java.lang.Exception`

### RSEPRCache

    public RSEPRCache(GCUBEServiceContext sctx)
               throws java.lang.Exception

  Default constructor of RSEPRCache that should be used by gCube services. It returns a new RSEPRCache object.

  Parameters:
    `sctx` - the context of the service that will be used to register to the notifications topic
  Throws:
    `java.lang.Exception`

### RSEPRCache

    public RSEPRCache(GCUBEServiceContext sctx,
                      long ttl,
                      long tti,
                      int maxElementsInMemory)
               throws java.lang.Exception

  Constructor of RSEPRCache that takes configuration parameters and creates a new cache with this configuration.

  Parameters:
    `sctx` - the context of the service that will be used to register to the notifications topic
    `ttl` - the default amount of time to live for an element from its creation date
    `tti` - the default amount of time to live for an element from its last accessed date
    `maxElementsInMemory` - the maximum number of elements in memory, before they are evicted
  Throws:
    `java.lang.Exception`

Method Detail

### add

    public void add(java.lang.Object query,
                    java.lang.String rsEpr)
             throws java.lang.Exception

  Adds a pair of query-RS EPR to the given cache

  Parameters:
    `query` - the key used to identify the added object in the cache. Equality is examined using the equals() method that is defined in the class of the query object
    `rsEpr` - the corresponding RS EPR for the results produced by the query
  Throws:
    `java.lang.Exception`

### get

    public java.lang.String get(java.lang.Object query)

  Retrieves a ResultSet EPR given the query that produced the ResultSet

  Parameters:
    `query` - the query that produced the ResultSet. Equality is examined using the equals() method that is defined in the class of the query object
  Returns:
    String the corresponding ResultSet EPR, null if it wasn't found

### size

    public int size()

  Size of the cache used

  Returns:
    int number of entries

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD