Class XmlaOlap4jNamedMemoryCache

java.lang.Object
org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache
All Implemented Interfaces:
XmlaOlap4jCache

public class XmlaOlap4jNamedMemoryCache extends Object implements XmlaOlap4jCache

Implementation of the XMLA SOAP cache that places its cache entries in memory for later use. It is thread safe and at static class level.

It supports cache sharing through the Name property.

All parameters are optional.

  • NAME
    A unique identifier which allows two connections to share a same cache space. Setting this to an already existing cache space will cause the cache manager to ignore other configuration properties, such as eviction mode and so on. Not setting this property will assign a random name to the cache space, thus creating a unique space.
  • SIZE
    The number of entries to maintain in cache under the given cache name.
  • TIMEOUT
    The number of seconds to maintain entries in cache before expiration.
  • MODE
    Supported eviction modes are LIFO (last in first out), FIFO (first in first out), LFU (least frequently used) and MFU (most frequently used)
See Also:
  • Constructor Details

    • XmlaOlap4jNamedMemoryCache

      public XmlaOlap4jNamedMemoryCache()
      Default constructor which instantiates the concurrent hash map.
  • Method Details

    • setParameters

      public String setParameters(Map<String,String> config, Map<String,String> props)
      Description copied from interface: XmlaOlap4jCache
      Convenience method to receive custom properties.

      The XMLA driver takes cache properties as "Cache.[property name]=[value]" in its JDBC url. All those properties should be striped of their "Cache." prefix and sent to this method as the props parameter.

      Also, the complete map of the current connection should be passed as the config parameter.

      Specified by:
      setParameters in interface XmlaOlap4jCache
      Parameters:
      config - The complete configuration parameters which were used to create the current connection.
      props - The properties received from the JDBC url.
      Returns:
      Returns a string object which gives a reference id to the caller for future use. This id has to be passed along with any future get and put requests.
    • get

      public byte[] get(String id, URL url, byte[] request) throws XmlaOlap4jInvalidStateException
      Description copied from interface: XmlaOlap4jCache
      Fetches a SOAP response from the cache. Returns null if there are no cached response corresponding to the SOAP message and the URL.
      Specified by:
      get in interface XmlaOlap4jCache
      Parameters:
      id - The connection unique name which called this cache.
      url - The URL where the SOAP message was sent.
      request - The SOAP complete message.
      Returns:
      The SOAP response, null if there are no corresponding response in the cache.
      Throws:
      XmlaOlap4jInvalidStateException
    • put

      public void put(String id, URL url, byte[] request, byte[] response) throws XmlaOlap4jInvalidStateException
      Description copied from interface: XmlaOlap4jCache
      Adds a SOAP response to the cache. It has to be relative to the URL of the SOAP service.
      Specified by:
      put in interface XmlaOlap4jCache
      Parameters:
      id - The connection unique name which called this cache.
      url - The URL of the SOAP endpoint.
      request - The full SOAP message from which we want to cache its response.
      response - The response to cache.
      Throws:
      XmlaOlap4jInvalidStateException
    • flushCache

      public void flushCache()
      Description copied from interface: XmlaOlap4jCache
      Tells the cache to flush all cached entries.
      Specified by:
      flushCache in interface XmlaOlap4jCache