1 package org.oxerr.vividseats.client.cached.redisson; 2 3 import java.util.concurrent.Executor; 4 import java.util.concurrent.ForkJoinPool; 5 6 import org.oxerr.vividseats.client.VividSeatsClient; 7 import org.oxerr.vividseats.client.cached.CachedVividSeatsClient; 8 import org.oxerr.vividseats.client.cached.redisson.inventory.RedissonCachedListingService; 9 import org.redisson.api.RedissonClient; 10 11 public class RedissonCachedVividSeatsClient implements CachedVividSeatsClient { 12 13 private final VividSeatsClient vividSeatsClient; 14 15 private final RedissonCachedListingService cachedSellerListingService; 16 17 public RedissonCachedVividSeatsClient( 18 VividSeatsClient vividSeatsClient, 19 RedissonClient redissonClient, 20 String keyPrefix 21 ) { 22 this(vividSeatsClient, redissonClient, keyPrefix, ForkJoinPool.commonPool()); 23 } 24 25 public RedissonCachedVividSeatsClient( 26 VividSeatsClient vividSeatsClient, 27 RedissonClient redissonClient, 28 String keyPrefix, 29 Executor executor 30 ) { 31 this( 32 vividSeatsClient, 33 new RedissonCachedListingService( 34 vividSeatsClient.getListingService(), 35 redissonClient, 36 keyPrefix, 37 executor 38 ) 39 ); 40 } 41 42 public RedissonCachedVividSeatsClient( 43 VividSeatsClient vividSeatsClient, 44 RedissonCachedListingService cachedSellerListingService 45 ) { 46 this.vividSeatsClient = vividSeatsClient; 47 this.cachedSellerListingService = cachedSellerListingService; 48 } 49 50 @Override 51 public VividSeatsClient getClient() { 52 return vividSeatsClient; 53 } 54 55 @Override 56 public RedissonCachedListingService getCachedListingService() { 57 return cachedSellerListingService; 58 } 59 60 }