Interface Cache

  • All Known Implementing Classes:
    DefaultCache

    public interface Cache
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Clear deletes all items stored in the cache.
      void delete​(java.lang.String key)
      Delete removes the specific key from the cache.
      boolean get​(java.lang.String key)
      Get returns the result for the given key.
      boolean set​(java.lang.String key, boolean value, java.lang.Object... extra)
      Set puts key and value into cache.
    • Method Detail

      • set

        boolean set​(java.lang.String key,
                    boolean value,
                    java.lang.Object... extra)
        Set puts key and value into cache. The first extra parameter should be a java.time.LocalDateTime object denoting the expected survival time. If survival time equals 0 or less, the key will always be valid.
        Parameters:
        key - the key to store
        value - the value to store
        extra - additional parameters (e.g., expiration time)
        Returns:
        true if successful, false otherwise
      • get

        boolean get​(java.lang.String key)
        Get returns the result for the given key. If there's no such key in the cache, Optional.empty() will be returned.
        Parameters:
        key - the key to retrieve
        Returns:
        an Optional containing the boolean value if present, otherwise Optional.empty()
      • delete

        void delete​(java.lang.String key)
        Delete removes the specific key from the cache. If the key doesn't exist, it returns false.
        Parameters:
        key - the key to delete
      • clear

        void clear()
        Clear deletes all items stored in the cache.