1 package org.oxerr.viagogo.client.cached.redisson;
2
3 import java.util.concurrent.Executor;
4 import java.util.concurrent.ForkJoinPool;
5
6 import org.oxerr.viagogo.client.ViagogoClient;
7 import org.oxerr.viagogo.client.cached.CachedViagogoClient;
8 import org.oxerr.viagogo.client.cached.redisson.inventory.RedissonCachedSellerListingService;
9 import org.redisson.api.RedissonClient;
10
11 public class RedissonCachedViagogoClient implements CachedViagogoClient {
12
13 private final ViagogoClient viagogoClient;
14
15 private final RedissonCachedSellerListingService cachedSellerListingService;
16
17 public RedissonCachedViagogoClient(
18 ViagogoClient viagogoClient,
19 RedissonClient redissonClient,
20 String keyPrefix
21 ) {
22 this(viagogoClient, redissonClient, keyPrefix, ForkJoinPool.commonPool());
23 }
24
25 public RedissonCachedViagogoClient(
26 ViagogoClient viagogoClient,
27 RedissonClient redissonClient,
28 String keyPrefix,
29 Executor executor
30 ) {
31 this(
32 viagogoClient,
33 new RedissonCachedSellerListingService(
34 viagogoClient.getSellerListingService(),
35 redissonClient,
36 keyPrefix,
37 executor
38 )
39 );
40 }
41
42 @Deprecated(since = "5.0.0", forRemoval = true)
43 public RedissonCachedViagogoClient(
44 ViagogoClient viagogoClient,
45 RedissonClient redissonClient,
46 String keyPrefix,
47 Executor executor,
48 boolean create
49 ) {
50 this(
51 viagogoClient,
52 new RedissonCachedSellerListingService(
53 viagogoClient.getSellerListingService(),
54 redissonClient,
55 keyPrefix,
56 executor,
57 create
58 )
59 );
60 }
61
62 public RedissonCachedViagogoClient(
63 ViagogoClient viagogoClient,
64 RedissonCachedSellerListingService cachedSellerListingService
65 ) {
66 this.viagogoClient = viagogoClient;
67 this.cachedSellerListingService = cachedSellerListingService;
68 }
69
70 @Override
71 public ViagogoClient getClient() {
72 return viagogoClient;
73 }
74
75 @Override
76 public RedissonCachedSellerListingService getCachedSellerListingsService() {
77 return this.getCachedSellerListingService();
78 }
79
80 @Override
81 public RedissonCachedSellerListingService getCachedSellerListingService() {
82 return cachedSellerListingService;
83 }
84
85 }