Interface ICache

All Known Implementing Classes:
MemoryCache, NullCache

public interface ICache
Interface for caches that are used to cache values to improve performance.
  • Method Summary

    Modifier and Type Method Description
    void remove​(String correlationId, String key)
    Removes a value from the cache by its key.
    Object retrieve​(String correlationId, String key)
    Retrieves cached value from the cache using its key.
    Object store​(String correlationId, String key, Object value, long timeout)
    Stores value in the cache with expiration time.
  • Method Details

    • retrieve

      Object retrieve​(String correlationId, String key)
      Retrieves cached value from the cache using its key. If value is missing in the cache or expired it returns null.
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique value key.
      Returns:
      a cached value or null if value wasn't found or timeout expired.
    • store

      Object store​(String correlationId, String key, Object value, long timeout)
      Stores value in the cache with expiration time.
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique value key.
      value - a value to store.
      timeout - expiration timeout in milliseconds.
      Returns:
      a cached value stored in the cache.
    • remove

      void remove​(String correlationId, String key)
      Removes a value from the cache by its key.
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique value key.