Interface ResourceCache

All Known Implementing Classes:
FileResourceCache

public interface ResourceCache
Interface for caching resource data.

Prevents excessive API calls and enables offline work.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the cache.
    get(String key)
    Retrieves data from the cache.
    Gets the global default cache instance.
    void
    put(String key, String data)
    Puts data into the cache.
  • Method Details

    • get

      Optional<String> get(String key)
      Retrieves data from the cache.
      Parameters:
      key - unique identifier (e.g., "pubchem_aspirin")
      Returns:
      Optional containing data if found
    • put

      void put(String key, String data)
      Puts data into the cache.
      Parameters:
      key - unique identifier
      data - data to store
    • clear

      void clear()
      Clears the cache.
    • global

      static ResourceCache global()
      Gets the global default cache instance.
      Returns:
      the global cache