Class JdbcGenericMapStore

java.lang.Object
com.loomcache.server.datastructures.mapstore.JdbcGenericMapStore
All Implemented Interfaces:
MapStore<String,String>, AutoCloseable

public final class JdbcGenericMapStore extends Object implements MapStore<String,String>, AutoCloseable
Built-in JDBC-backed MapStore for declarative data-connection-ref usage.

The store is intentionally String/String because the current server-side distributed map registry exposes DistributedMap<String, String>. Operators provide the table and column names declaratively; all values are bound as prepared-statement parameters.

  • Constructor Details

  • Method Details

    • load

      public @Nullable String load(String key)
      Description copied from interface: MapStore
      Load the value associated with key from the backing store.
      Specified by:
      load in interface MapStore<String,String>
      Parameters:
      key - the key to look up (never null)
      Returns:
      the associated value, or null when no value exists
    • loadAllKeys

      public Iterable<String> loadAllKeys()
      Description copied from interface: MapStore
      Stream every key known to the backing store. Used for EAGER preload. Default returns an empty iterable, which disables EAGER preload.
      Specified by:
      loadAllKeys in interface MapStore<String,String>
      Returns:
      an iterable over all persisted keys
    • store

      public void store(String key, String value)
      Description copied from interface: MapStore
      Persist a single key/value pair.
      Specified by:
      store in interface MapStore<String,String>
      Parameters:
      key - the key (never null)
      value - the value to persist (never null)
    • storeAll

      public void storeAll(Map<? extends String, ? extends String> entries)
      Description copied from interface: MapStore
      Persist multiple key/value pairs. Default implementation loops MapStore.store(Object, Object); override for efficiency when the store supports bulk writes.
      Specified by:
      storeAll in interface MapStore<String,String>
      Parameters:
      entries - entries to persist (never null)
    • delete

      public void delete(String key)
      Description copied from interface: MapStore
      Remove a single key from the backing store. No-op when the key is absent.
      Specified by:
      delete in interface MapStore<String,String>
      Parameters:
      key - the key to delete (never null)
    • deleteAll

      public void deleteAll(Collection<? extends String> keys)
      Description copied from interface: MapStore
      Remove multiple keys. Default implementation loops MapStore.delete(Object); override for efficiency when the store supports bulk deletes.
      Specified by:
      deleteAll in interface MapStore<String,String>
      Parameters:
      keys - keys to delete (never null)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable