Interface CacheService

  • All Implemented Interfaces:

    
    public interface CacheService
    
                        

    Represents a component that facilitates caching.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract boolean set(@NonNull() String cacheName, @NonNull() String key, @NonNull() CacheEntry value) Creates or updates the key-value pair in the cache.
      abstract CacheResult get(@NonNull() String cacheName, @NonNull() String key) Retrieves the item associated with the key from the cache.
      abstract boolean remove(@NonNull() String cacheName, @NonNull() String key) Removes the item associated with the key from the cache.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • set

         abstract boolean set(@NonNull() String cacheName, @NonNull() String key, @NonNull() CacheEntry value)

        Creates or updates the key-value pair in the cache.

        Parameters:
        cacheName - name of the cache where the cache entry is to be created
        key - key for the item to be cached
        value - the value that is to be associated with key
      • get

        @Nullable() abstract CacheResult get(@NonNull() String cacheName, @NonNull() String key)

        Retrieves the item associated with the key from the cache.

        Parameters:
        cacheName - name of the cache where the key should be queried from
        key - key for the cache entry
        Returns:

        a valid cache entry for the key if one exists; null otherwise.

      • remove

         abstract boolean remove(@NonNull() String cacheName, @NonNull() String key)

        Removes the item associated with the key from the cache.

        Parameters:
        cacheName - name of the cache where the item is to be removed from
        key - the key for the item that is to be removed
        Returns:

        true if the item has been removed; false otherwise.