Class XmlaOlap4jNamedMemoryCache

  • All Implemented Interfaces:
    XmlaOlap4jCache

    public class XmlaOlap4jNamedMemoryCache
    extends java.lang.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:
    XmlaOlap4jNamedMemoryCache.Property
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlaOlap4jNamedMemoryCache()
      Default constructor which instantiates the concurrent hash map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void flushCache()
      Tells the cache to flush all cached entries.
      byte[] get​(java.lang.String id, java.net.URL url, byte[] request)
      Fetches a SOAP response from the cache.
      void put​(java.lang.String id, java.net.URL url, byte[] request, byte[] response)
      Adds a SOAP response to the cache.
      java.lang.String setParameters​(java.util.Map<java.lang.String,​java.lang.String> config, java.util.Map<java.lang.String,​java.lang.String> props)
      Convenience method to receive custom properties.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XmlaOlap4jNamedMemoryCache

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

      • setParameters

        public java.lang.String setParameters​(java.util.Map<java.lang.String,​java.lang.String> config,
                                              java.util.Map<java.lang.String,​java.lang.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​(java.lang.String id,
                          java.net.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​(java.lang.String id,
                        java.net.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