Class RedissonCachedSellerListingService
java.lang.Object
org.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,String,CreateSellerListingRequest,ViagogoListing,ViagogoEvent,ViagogoCachedListing>
org.oxerr.viagogo.client.cached.redisson.inventory.RedissonCachedSellerListingService
- All Implemented Interfaces:
org.oxerr.ticket.inventory.support.cached.CachedListingService<String,
,String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent> CachedSellerListingService
,CachedSellerListingsService
- Direct Known Subclasses:
RedissonCachedSellerListingsService
public class RedissonCachedSellerListingService
extends org.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,String,CreateSellerListingRequest,ViagogoListing,ViagogoEvent,ViagogoCachedListing>
implements CachedSellerListingsService, CachedSellerListingService
-
Field Summary
Fields inherited from class org.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport
executor, keyPrefix, redisson
-
Constructor Summary
ConstructorDescriptionRedissonCachedSellerListingService
(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor) Constructs with defaultListingConfiguration
and defaultRetryConfiguration
.RedissonCachedSellerListingService
(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor, boolean create) Deprecated, for removal: This API element is subject to removal in a future version.RedissonCachedSellerListingService
(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor, org.oxerr.ticket.inventory.support.cached.redisson.ListingConfiguration listingConfiguration, int pageSize, RetryConfiguration retryConfiguration) Constructs with specifiedListingConfiguration
and specifiedRetryConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
check()
Check all listings and delete which not in cache.protected void
createListing
(ViagogoEvent event, ViagogoListing listing) protected void
deleteListing
(ViagogoEvent event, String listingId) protected int
getPriority
(ViagogoEvent event, ViagogoListing listing, ViagogoCachedListing cachedListing) protected boolean
shouldCreate
(ViagogoEvent event, ViagogoListing listing, ViagogoCachedListing cachedListing) protected boolean
shouldDelete
(ViagogoEvent event, Set<String> inventoryListingIds, String listingId, ViagogoCachedListing cachedListing) protected boolean
shouldUpdate
(ViagogoEvent event, ViagogoListing listing, ViagogoCachedListing cachedListing) protected ViagogoCachedListing
toCached
(ViagogoEvent event, ViagogoListing listing, org.oxerr.ticket.inventory.support.cached.redisson.Status status) Methods inherited from class org.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport
callAsync, callAsync, createListing, deleteListing, getCache, getCache, getCacheName, getCacheName, getCacheNamePattern, getCacheNamesStream, getCacheNamesStream, getCacheSize, getEventCache, getListedCount, getListedRequest, getListedRequest, getListedRequest, getListedRequest, getRequest, getRequest, getRequest, getRequest, isListed, isListed, toSupplier, updateListing, updateListing, updateListings
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.oxerr.ticket.inventory.support.cached.CachedListingService
getCacheNamesStream, getCacheNamesStream, getCacheSize, getListedCount, getListedRequest, getListedRequest, getListedRequest, getListedRequest, getRequest, getRequest, getRequest, getRequest, isListed, isListed, updateListings
-
Constructor Details
-
RedissonCachedSellerListingService
@Deprecated(since="5.0.0", forRemoval=true) public RedissonCachedSellerListingService(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor, boolean create) Deprecated, for removal: This API element is subject to removal in a future version. -
RedissonCachedSellerListingService
public RedissonCachedSellerListingService(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor) Constructs with defaultListingConfiguration
and defaultRetryConfiguration
.- Parameters:
sellerListingService
- the seller listing service.redissonClient
- the redisson client.keyPrefix
- the key prefix for the cache.executor
- the executor.- Since:
- 5.0.0
-
RedissonCachedSellerListingService
public RedissonCachedSellerListingService(SellerListingService sellerListingService, org.redisson.api.RedissonClient redissonClient, String keyPrefix, Executor executor, org.oxerr.ticket.inventory.support.cached.redisson.ListingConfiguration listingConfiguration, int pageSize, RetryConfiguration retryConfiguration) Constructs with specifiedListingConfiguration
and specifiedRetryConfiguration
.- Parameters:
sellerListingService
- the seller listing service.redissonClient
- the redisson client.keyPrefix
- the key prefix for the cache.executor
- the executor.listingConfiguration
- the listing configuration.pageSize
- the page size when do check.retryConfiguration
- the retry configuration.- Since:
- 5.0.0
-
-
Method Details
-
shouldCreate
protected boolean shouldCreate(@Nonnull ViagogoEvent event, @Nonnull ViagogoListing listing, @Nullable ViagogoCachedListing cachedListing) - Overrides:
shouldCreate
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing>
-
shouldUpdate
protected boolean shouldUpdate(@Nonnull ViagogoEvent event, @Nonnull ViagogoListing listing, @Nullable ViagogoCachedListing cachedListing) - Overrides:
shouldUpdate
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing>
-
getPriority
protected int getPriority(@Nonnull ViagogoEvent event, @Nullable ViagogoListing listing, @Nullable ViagogoCachedListing cachedListing) - Overrides:
getPriority
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing>
-
shouldDelete
protected boolean shouldDelete(@Nonnull ViagogoEvent event, @Nonnull Set<String> inventoryListingIds, @Nonnull String listingId, @Nonnull ViagogoCachedListing cachedListing) - Overrides:
shouldDelete
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing>
-
createListing
- Specified by:
createListing
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing> - Throws:
IOException
-
deleteListing
- Specified by:
deleteListing
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing> - Throws:
IOException
-
toCached
protected ViagogoCachedListing toCached(ViagogoEvent event, ViagogoListing listing, org.oxerr.ticket.inventory.support.cached.redisson.Status status) - Specified by:
toCached
in classorg.oxerr.ticket.inventory.support.cached.redisson.RedissonCachedListingServiceSupport<String,
String, CreateSellerListingRequest, ViagogoListing, ViagogoEvent, ViagogoCachedListing>
-
check
public void check()Description copied from interface:CachedSellerListingService
Check all listings and delete which not in cache.- Specified by:
check
in interfaceCachedSellerListingService
-