Package net.snowflake.client.core

## Class QueryContextCache

- java.lang.Object
- - net.snowflake.client.core.QueryContextCache

    public class QueryContextCache
    extends Object

Most Recently Used and Priority based cache. A separate cache for each connection in the driver.

### Constructor Summary

Constructors
`QueryContextCache​(int capacity)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clearCache()` Clear the cache.
`void` `deserializeQueryContextDTO​(QueryContextDTO queryContextDTO)` Deserialize the QueryContext cache from a QueryContextDTO object.
`void` `deserializeQueryContextJson​(String data)`
`QueryContextDTO` `serializeQueryContextDTO()` Serialize the QueryContext cache to a QueryContextDTO object, which can be serialized to JSON automatically later.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### QueryContextCache

    public QueryContextCache​(int capacity)

Constructor.

Parameters:
  `capacity` - Maximum capacity of the cache.

### Method Detail

#### clearCache

    public void clearCache()

Clear the cache.

#### deserializeQueryContextJson

    public void deserializeQueryContextJson​(String data)

Parameters:
  `data` - : the QueryContext Object serialized as a JSON format string

#### deserializeQueryContextDTO

    public void deserializeQueryContextDTO​(QueryContextDTO queryContextDTO)

Deserialize the QueryContext cache from a QueryContextDTO object. This function currently is only used in QueryContextCacheTest.java where we check that after serialization and deserialization, the cache is the same as before.

Parameters:
  `queryContextDTO` - QueryContextDTO to deserialize.

#### serializeQueryContextDTO

    public QueryContextDTO serializeQueryContextDTO()

Serialize the QueryContext cache to a QueryContextDTO object, which can be serialized to JSON automatically later.

Returns:
  `QueryContextDTO`