Class CaffeineSpec

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CaffeineSpec​(java.lang.String specification)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void configure​(java.lang.String key, java.lang.String value)
      Configures the setting.
      (package private) static long durationInNanos​(long duration, java.util.concurrent.TimeUnit unit)
      Converts an expiration duration/unit pair into a single long for hashing and equality.
      boolean equals​(java.lang.Object o)  
      (package private) void expireAfterAccess​(java.lang.String key, java.lang.String value)
      Configures expire after access.
      (package private) void expireAfterWrite​(java.lang.String key, java.lang.String value)
      Configures expire after write.
      int hashCode()  
      (package private) void initialCapacity​(java.lang.String key, java.lang.String value)
      Configures the initial capacity.
      (package private) void maximumSize​(java.lang.String key, java.lang.String value)
      Configures the maximum size.
      (package private) void maximumWeight​(java.lang.String key, java.lang.String value)
      Configures the maximum size.
      static CaffeineSpec parse​(java.lang.String specification)
      Creates a CaffeineSpec from a string.
      (package private) static long parseDuration​(java.lang.String key, java.lang.String value)
      Returns a parsed duration value.
      (package private) static int parseInt​(java.lang.String key, java.lang.String value)
      Returns a parsed int value.
      (package private) static long parseLong​(java.lang.String key, java.lang.String value)
      Returns a parsed long value.
      (package private) void parseOption​(java.lang.String option)
      Parses and applies the configuration option.
      (package private) static java.util.concurrent.TimeUnit parseTimeUnit​(java.lang.String key, java.lang.String value)
      Returns a parsed TimeUnit value.
      (package private) void recordStats​(java.lang.String value)
      Configures the value as weak or soft references.
      (package private) void refreshAfterWrite​(java.lang.String key, java.lang.String value)
      Configures refresh after write.
      (package private) Caffeine<java.lang.Object,​java.lang.Object> toBuilder()
      Returns a Caffeine builder configured according to this specification.
      java.lang.String toParsableString()
      Returns a string that can be used to parse an equivalent CaffeineSpec.
      java.lang.String toString()
      Returns a string representation for this CaffeineSpec instance.
      (package private) void valueStrength​(java.lang.String key, java.lang.String value, Caffeine.Strength strength)
      Configures the value as weak or soft references.
      (package private) void weakKeys​(java.lang.String value)
      Configures the keys as weak references.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • specification

        final java.lang.String specification
      • initialCapacity

        int initialCapacity
      • maximumWeight

        long maximumWeight
      • maximumSize

        long maximumSize
      • recordStats

        boolean recordStats
      • expireAfterAccessDuration

        long expireAfterAccessDuration
      • expireAfterAccessTimeUnit

        java.util.concurrent.TimeUnit expireAfterAccessTimeUnit
      • expireAfterWriteDuration

        long expireAfterWriteDuration
      • expireAfterWriteTimeUnit

        java.util.concurrent.TimeUnit expireAfterWriteTimeUnit
      • refreshAfterWriteDuration

        long refreshAfterWriteDuration
      • refreshAfterWriteTimeUnit

        java.util.concurrent.TimeUnit refreshAfterWriteTimeUnit
    • Constructor Detail

      • CaffeineSpec

        private CaffeineSpec​(java.lang.String specification)
    • Method Detail

      • toBuilder

        Caffeine<java.lang.Object,​java.lang.Object> toBuilder()
        Returns a Caffeine builder configured according to this specification.
        Returns:
        a builder configured to the specification
      • parse

        public static CaffeineSpec parse​(java.lang.String specification)
        Creates a CaffeineSpec from a string.
        Parameters:
        specification - the string form
        Returns:
        the parsed specification
      • parseOption

        void parseOption​(java.lang.String option)
        Parses and applies the configuration option.
      • configure

        void configure​(java.lang.String key,
                       @Nullable
                       java.lang.String value)
        Configures the setting.
      • initialCapacity

        void initialCapacity​(java.lang.String key,
                             java.lang.String value)
        Configures the initial capacity.
      • maximumSize

        void maximumSize​(java.lang.String key,
                         java.lang.String value)
        Configures the maximum size.
      • maximumWeight

        void maximumWeight​(java.lang.String key,
                           java.lang.String value)
        Configures the maximum size.
      • weakKeys

        void weakKeys​(@Nullable
                      java.lang.String value)
        Configures the keys as weak references.
      • valueStrength

        void valueStrength​(java.lang.String key,
                           @Nullable
                           java.lang.String value,
                           Caffeine.Strength strength)
        Configures the value as weak or soft references.
      • expireAfterAccess

        void expireAfterAccess​(java.lang.String key,
                               java.lang.String value)
        Configures expire after access.
      • expireAfterWrite

        void expireAfterWrite​(java.lang.String key,
                              java.lang.String value)
        Configures expire after write.
      • refreshAfterWrite

        void refreshAfterWrite​(java.lang.String key,
                               java.lang.String value)
        Configures refresh after write.
      • recordStats

        void recordStats​(@Nullable
                         java.lang.String value)
        Configures the value as weak or soft references.
      • parseInt

        static int parseInt​(java.lang.String key,
                            java.lang.String value)
        Returns a parsed int value.
      • parseLong

        static long parseLong​(java.lang.String key,
                              java.lang.String value)
        Returns a parsed long value.
      • parseDuration

        static long parseDuration​(java.lang.String key,
                                  java.lang.String value)
        Returns a parsed duration value.
      • parseTimeUnit

        static java.util.concurrent.TimeUnit parseTimeUnit​(java.lang.String key,
                                                           java.lang.String value)
        Returns a parsed TimeUnit value.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • durationInNanos

        static long durationInNanos​(long duration,
                                    @Nullable
                                    java.util.concurrent.TimeUnit unit)
        Converts an expiration duration/unit pair into a single long for hashing and equality.
      • toParsableString

        public java.lang.String toParsableString()
        Returns a string that can be used to parse an equivalent CaffeineSpec. The order and form of this representation is not guaranteed, except that parsing its output will produce a CaffeineSpec equal to this instance.
        Returns:
        a string representation of this specification
      • toString

        public java.lang.String toString()
        Returns a string representation for this CaffeineSpec instance. The form of this representation is not guaranteed.
        Overrides:
        toString in class java.lang.Object