Class EmbeddedLoomCache

java.lang.Object
com.loomcache.server.embedded.EmbeddedLoomCache
All Implemented Interfaces:
AutoCloseable

public class EmbeddedLoomCache extends Object implements AutoCloseable
In-process cache instance for embedded LoomCache usage.

Features: - No network overhead for in-process access - Builder pattern for configuration - Thread-safe access to all data structures - Optional REST API for external access - Standalone or cluster-aware mode - Direct Java API (no network serialization)

Usage:

EmbeddedLoomCache cache = EmbeddedLoomCache.builder()
    .dataDir("./data")
    .standalone()
    .build();

cache.start();

DistributedMapinvalid input: '<'String, String> map = cache.getMap("myMap");
map.put("key1", "value1");

cache.shutdown();
  • Constructor Details

    • EmbeddedLoomCache

      protected EmbeddedLoomCache(String nodeId, Path dataDir, String clusterName, int port, int restPort, boolean standalone, List<String> seedNodes, @Nullable String advertisedHost, boolean enablePersistence, int maxMapEntries, String mapEvictionPolicy, long maxMemoryBytes, boolean readBackupData)
  • Method Details

    • start

      public void start() throws Exception
      Start the embedded cache.
      Throws:
      Exception - if startup fails
    • shutdown

      public void shutdown()
      Shut down the embedded cache gracefully.
    • getMap

      public DistributedMap<String,String> getMap(String name)
      Get or create a distributed map.
      Parameters:
      name - the map name
      Returns:
      the distributed map
    • getQueue

      public DistributedQueue<String> getQueue(String name)
      Get or create a distributed queue.
      Parameters:
      name - the queue name
      Returns:
      the distributed queue
    • getSet

      public DistributedSet<String> getSet(String name)
      Get or create a distributed set.
      Parameters:
      name - the set name
      Returns:
      the distributed set
    • getTopic

      public DistributedTopic<String> getTopic(String name)
      Get or create a distributed topic.
      Parameters:
      name - the topic name
      Returns:
      the distributed topic
    • isRestEnabled

      public boolean isRestEnabled()
      Check if REST API is enabled.
    • builder

      public static EmbeddedLoomCacheBuilder builder()
      Create a new builder for EmbeddedLoomCache.
    • close

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