Package io.vertx.httpproxy.cache

## Class CacheOptions

- java.lang.Object
- - io.vertx.httpproxy.cache.CacheOptions

-     public class CacheOptions
      extends Object

  Cache options.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_MAX_SIZE` | Default max size of the cache = 1000
    `static String` | `DEFAULT_NAME` | Actual name of anonymous shared cache = `__vertx.DEFAULT`
    `static boolean` | `DEFAULT_SHARED` | Default shared cache = `false`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CacheOptions()` | Default constructor.
    `CacheOptions​(JsonObject json)` | Constructor to create an options from JSON.
    `CacheOptions​(CacheOptions other)` | Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getMaxSize()` |
    `String` | `getName()` |
    `boolean` | `isShared()` |
    `CacheOptions` | `setMaxSize​(int maxSize)` | Set the max number of entries the cache can hold.
    `CacheOptions` | `setName​(String name)` | Set the cache name, used when the cache is shared, otherwise ignored.
    `CacheOptions` | `setShared​(boolean shared)` | Set to `true` to share the cache.
    `JsonObject` | `toJson()` | Convert to JSON.
    `String` | `toString()` |

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

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

- - ### Field Detail

    - #### DEFAULT_MAX_SIZE

          public static final int DEFAULT_MAX_SIZE

      Default max size of the cache = 1000
      See Also:
        Constant Field Values

    - #### DEFAULT_NAME

          public static final String DEFAULT_NAME

      Actual name of anonymous shared cache = `__vertx.DEFAULT`
      See Also:
        Constant Field Values

    - #### DEFAULT_SHARED

          public static final boolean DEFAULT_SHARED

      Default shared cache = `false`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CacheOptions

          public CacheOptions()

      Default constructor.

    - #### CacheOptions

          public CacheOptions​(CacheOptions other)

      Copy constructor.
      Parameters:
        `other` - the options to copy

    - #### CacheOptions

          public CacheOptions​(JsonObject json)

      Constructor to create an options from JSON.
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### getMaxSize

          public int getMaxSize()

      Returns:
        the max number of entries the cache can hold.

    - #### setMaxSize

          public CacheOptions setMaxSize​(int maxSize)

      Set the max number of entries the cache can hold.
      Parameters:
        `maxSize` - the max size
      Returns:
        a reference to this, so the API can be used fluently

    - #### getName

          public String getName()

      Returns:
        the cache name used for sharing

    - #### setName

          public CacheOptions setName​(String name)

      Set the cache name, used when the cache is shared, otherwise ignored.
      Parameters:
        `name` - the new name
      Returns:
        a reference to this, so the API can be used fluently

    - #### isShared

          public boolean isShared()

      Returns:
        whether the cache is shared

    - #### setShared

          public CacheOptions setShared​(boolean shared)

      Set to `true` to share the cache.

      There can be multiple shared caches distinguished by `getName()`, when no specific name is set, the `DEFAULT_NAME` is used.

      Parameters:
        `shared` - `true` to use a shared client
      Returns:
        a reference to this, so the API can be used fluently

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toJson

          public JsonObject toJson()

      Convert to JSON.
      Returns:
        the JSON