1 package org.oxerr.seatgeek.client.cached.redisson;
2
3 import java.util.concurrent.Executor;
4 import java.util.concurrent.ForkJoinPool;
5
6 import org.oxerr.seatgeek.client.SeatGeekClient;
7 import org.oxerr.seatgeek.client.cached.CachedSeatGeekClient;
8 import org.redisson.api.RedissonClient;
9
10 public class RedissonCachedSeatGeekClient implements CachedSeatGeekClient {
11
12 private final SeatGeekClient seatGeekClient;
13
14 private final RedissonCachedListingService cachedListingService;
15
16 public RedissonCachedSeatGeekClient(
17 SeatGeekClient seatGeekClient,
18 RedissonClient redissonClient,
19 String keyPrefix
20 ) {
21 this(seatGeekClient, redissonClient, keyPrefix, ForkJoinPool.commonPool());
22 }
23
24 public RedissonCachedSeatGeekClient(
25 SeatGeekClient seatGeekClient,
26 RedissonClient redissonClient,
27 String keyPrefix,
28 Executor executor
29 ) {
30 this(seatGeekClient, redissonClient, keyPrefix, executor, true);
31 }
32
33 public RedissonCachedSeatGeekClient(
34 SeatGeekClient seatGeekClient,
35 RedissonClient redissonClient,
36 String keyPrefix,
37 Executor executor,
38 boolean create
39 ) {
40 this(
41 seatGeekClient,
42 new RedissonCachedListingService(
43 seatGeekClient.getListingService(),
44 redissonClient,
45 keyPrefix,
46 executor,
47 create
48 )
49 );
50 }
51
52 public RedissonCachedSeatGeekClient(
53 SeatGeekClient seatGeekClient,
54 RedissonCachedListingService cachedListingService
55 ) {
56 this.seatGeekClient = seatGeekClient;
57 this.cachedListingService = cachedListingService;
58 }
59
60 @Override
61 public SeatGeekClient getClient() {
62 return this.seatGeekClient;
63 }
64
65 @Override
66 public RedissonCachedListingService getCachedListingService() {
67 return this.cachedListingService;
68 }
69
70 }