CacheService
in package
Table of Contents
Constants
- RESOURCE_VALIDITY_TIME = 60 * 15
- STATUS_EXCLUDE_FILERS = ["isNot", "notIn"]
- STATUS_INCLUDE_FILTERS = ["is", "in"]
- SUBSCRIPTION_STATUSES = ["future", "in_trial", "active", "non_renewing", "paused", "cancelled"]
Properties
- $chargebeeUserIdClientIdMap : array<string|int, int>
- $checkoutPlanRepository : CheckoutPlanRepository
- $checkoutRequestRepository : CheckoutRequestRepository
- $clientIdChargebeeUserIdMap : array<string|int, string>
- $clientRepository : ClientRepository
- $countryService : CountryService
- $entityManager : EntityManager
- $l : Logger
- $proformaSubscriptionRepository : ProformaSubscriptionRepository
- $redis : Redis
Methods
- __construct() : mixed
- addCheckoutRequestToCache() : mixed
- addCouponToCache() : mixed
- addCustomerToCache() : mixed
- addPlanToCache() : mixed
- addResource() : mixed
- addSubscriptionToCache() : mixed
- fetchResource() : mixed
- getAddonCacheKey() : mixed
- getCacheKeyByCustomer() : mixed
- getCacheKeyByPlan() : mixed
- getCacheKeyBySubscription() : mixed
- getChargebeeAddonById() : mixed
- getChargebeeUserIdByClientId() : mixed
- getClientIdByChargebeeUserId() : mixed
- getClientSubscriptionChecktimeKey() : mixed
- getCouponById() : mixed
- getCouponCodeByCode() : mixed
- getCouponCodeCacheKey() : mixed
- getCouponIdCacheKey() : mixed
- getCustomerByClient() : mixed
- getCustomerCacheKeyByClientId() : mixed
- getCustomerTaxRateByChargebeeUserId() : mixed
- getOssCacheKeyByClientId() : mixed
- getPlansByIdList() : mixed
- getProformaCacheKeyByClientId() : mixed
- getSubscriptionBaseKeyByClientId() : mixed
- getSubscriptionsByClientId() : mixed
- getTaxLetterCacheKeyByClientId() : mixed
- getTaxRateByClientId() : mixed
- getTaxRateKeyByClientId() : mixed
- getVatRegCacheKeyByClientId() : mixed
- removeRequestSubscriptionsFromCache() : mixed
- removeResource() : mixed
- syncCoupons() : mixed
- syncCustomers() : mixed
- syncPlans() : mixed
- syncSubscriptions() : mixed
- syncSubscriptionsFromChargebee() : mixed
- clientHasSubscriptionCache() : mixed
- customerBillingDataHasChanged() : mixed
- customerHasStoredTaxRateByClientId() : mixed
- fetchRawResource() : mixed
- formatCheckoutRequestSubscriptionValues() : mixed
- getCustomerTaxRateByClientId() : mixed
- getObjectValues() : mixed
- getPlanTypeIdBySubscription() : int|null
- initNewInstance() : mixed
- isValidCustomerData() : mixed
- isValidPlanData() : mixed
- isValidSubscriptionData() : mixed
- rawResourceHasValidTimeStamp() : mixed
- removeRequestSubscriptionFromCache() : mixed
- serializeResource() : mixed
- syncPendingSubscriptionsFromDb() : mixed
- updatePlanInDb() : mixed
- updateProformaSubscriptionInDb() : mixed
Constants
RESOURCE_VALIDITY_TIME
public
mixed
RESOURCE_VALIDITY_TIME
= 60 * 15
STATUS_EXCLUDE_FILERS
public
mixed
STATUS_EXCLUDE_FILERS
= ["isNot", "notIn"]
STATUS_INCLUDE_FILTERS
public
mixed
STATUS_INCLUDE_FILTERS
= ["is", "in"]
SUBSCRIPTION_STATUSES
public
mixed
SUBSCRIPTION_STATUSES
= ["future", "in_trial", "active", "non_renewing", "paused", "cancelled"]
Properties
$chargebeeUserIdClientIdMap
private
array<string|int, int>
$chargebeeUserIdClientIdMap
= []
$checkoutPlanRepository
private
CheckoutPlanRepository
$checkoutPlanRepository
$checkoutRequestRepository
private
CheckoutRequestRepository
$checkoutRequestRepository
$clientIdChargebeeUserIdMap
private
array<string|int, string>
$clientIdChargebeeUserIdMap
= []
$clientRepository
private
ClientRepository
$clientRepository
$countryService
private
CountryService
$countryService
$entityManager
private
EntityManager
$entityManager
$l
private
Logger
$l
$proformaSubscriptionRepository
private
ProformaSubscriptionRepository
$proformaSubscriptionRepository
$redis
private
Redis
$redis
Methods
__construct()
public
__construct(Redis $redis, ClientRepository $clientRepository, CheckoutPlanRepository $checkoutPlanRepository, CheckoutRequestRepository $checkoutRequestRepository, CountryService $countryService, ProformaSubscriptionRepository $proformaSubscriptionRepository, EntityManager $entityManager) : mixed
Parameters
- $redis : Redis
- $clientRepository : ClientRepository
- $checkoutPlanRepository : CheckoutPlanRepository
- $checkoutRequestRepository : CheckoutRequestRepository
- $countryService : CountryService
- $proformaSubscriptionRepository : ProformaSubscriptionRepository
- $entityManager : EntityManager
addCheckoutRequestToCache()
public
addCheckoutRequestToCache(CheckoutRequest $checkoutRequest) : mixed
Parameters
- $checkoutRequest : CheckoutRequest
addCouponToCache()
public
addCouponToCache(Coupon $coupon[, int|null $retrieveTime = null ]) : mixed
Parameters
- $coupon : Coupon
- $retrieveTime : int|null = null
addCustomerToCache()
public
addCustomerToCache(Customer $customer[, int|null $retrieveTime = null ]) : mixed
Parameters
- $customer : Customer
- $retrieveTime : int|null = null
addPlanToCache()
public
addPlanToCache(Plan $plan[, int|null $retrieveTime = null ]) : mixed
Parameters
- $plan : Plan
- $retrieveTime : int|null = null
addResource()
public
addResource(int $type, string $key, mixed $resource[, int $retrieveTime = null ][, mixed $subKey = null ]) : mixed
Parameters
- $type : int
-
as specified by \Redis class constants. Accepts REDIS_STRING, REDIS_HASH and REDIS_SET
- $key : string
-
the key for the resource
- $resource : mixed
-
the resource to be stored
- $retrieveTime : int = null
- $subKey : mixed = null
-
applicable to hashes
addSubscriptionToCache()
public
addSubscriptionToCache(Subscription $subscription[, int|null $retrieveTime = null ]) : mixed
Parameters
- $subscription : Subscription
- $retrieveTime : int|null = null
fetchResource()
public
fetchResource(int $type, string $key[, int|string $subKey = null ]) : mixed
Parameters
- $type : int
-
as specified by \Redis class constants. Accepts REDIS_STRING, REDIS_HASH and REDIS_SET
- $key : string
-
the key for the resource
- $subKey : int|string = null
-
applicable to hashes
getAddonCacheKey()
public
getAddonCacheKey() : mixed
getCacheKeyByCustomer()
public
getCacheKeyByCustomer(mixed $customer) : mixed
Parameters
- $customer : mixed
getCacheKeyByPlan()
public
getCacheKeyByPlan([mixed $plan = null ]) : mixed
Parameters
- $plan : mixed = null
getCacheKeyBySubscription()
public
getCacheKeyBySubscription(Subscription $subscription) : mixed
Parameters
- $subscription : Subscription
getChargebeeAddonById()
public
getChargebeeAddonById(string $id) : mixed
Parameters
- $id : string
getChargebeeUserIdByClientId()
public
getChargebeeUserIdByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getClientIdByChargebeeUserId()
public
getClientIdByChargebeeUserId(string $chargebeeUserId) : mixed
Parameters
- $chargebeeUserId : string
getClientSubscriptionChecktimeKey()
public
getClientSubscriptionChecktimeKey(int $clientId) : mixed
Parameters
- $clientId : int
getCouponById()
public
getCouponById(string $couponId) : mixed
Parameters
- $couponId : string
getCouponCodeByCode()
public
getCouponCodeByCode(string $code) : mixed
Parameters
- $code : string
getCouponCodeCacheKey()
public
getCouponCodeCacheKey() : mixed
getCouponIdCacheKey()
public
getCouponIdCacheKey() : mixed
getCustomerByClient()
public
getCustomerByClient(Client $client) : mixed
Parameters
- $client : Client
getCustomerCacheKeyByClientId()
public
getCustomerCacheKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getCustomerTaxRateByChargebeeUserId()
public
getCustomerTaxRateByChargebeeUserId(string $chargebeeCustomerId) : mixed
Parameters
- $chargebeeCustomerId : string
getOssCacheKeyByClientId()
public
getOssCacheKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getPlansByIdList()
public
getPlansByIdList(array<string|int, mixed> $idList) : mixed
Parameters
- $idList : array<string|int, mixed>
getProformaCacheKeyByClientId()
public
getProformaCacheKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getSubscriptionBaseKeyByClientId()
public
getSubscriptionBaseKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getSubscriptionsByClientId()
public
getSubscriptionsByClientId(int $clientId, array<string|int, mixed> $filterParams[, mixed $ignoreTimestamps = false ]) : mixed
Parameters
- $clientId : int
- $filterParams : array<string|int, mixed>
- $ignoreTimestamps : mixed = false
getTaxLetterCacheKeyByClientId()
public
getTaxLetterCacheKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getTaxRateByClientId()
public
getTaxRateByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getTaxRateKeyByClientId()
public
getTaxRateKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getVatRegCacheKeyByClientId()
public
getVatRegCacheKeyByClientId(int $clientId) : mixed
Parameters
- $clientId : int
removeRequestSubscriptionsFromCache()
public
removeRequestSubscriptionsFromCache(CheckoutRequest $checkoutRequest) : mixed
Parameters
- $checkoutRequest : CheckoutRequest
removeResource()
public
removeResource(int $type, string $key[, mixed $subKey = null ]) : mixed
Parameters
- $type : int
-
as specified by \Redis class constants. Accepts REDIS_STRING, REDIS_HASH and REDIS_SET
- $key : string
-
the key for the resource
- $subKey : mixed = null
-
key in case of hash, member in case of set
syncCoupons()
public
syncCoupons([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
syncCustomers()
public
syncCustomers([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
syncPlans()
public
syncPlans([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
syncSubscriptions()
public
syncSubscriptions([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
syncSubscriptionsFromChargebee()
public
syncSubscriptionsFromChargebee([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
clientHasSubscriptionCache()
private
clientHasSubscriptionCache(Client $client) : mixed
Parameters
- $client : Client
customerBillingDataHasChanged()
private
customerBillingDataHasChanged(Customer $newCustomer) : mixed
Parameters
- $newCustomer : Customer
customerHasStoredTaxRateByClientId()
private
customerHasStoredTaxRateByClientId(int $clientId) : mixed
Parameters
- $clientId : int
fetchRawResource()
private
fetchRawResource(int $type, string $key[, int|string $subKey = null ]) : mixed
Parameters
- $type : int
-
as specified by \Redis class constants. Accepts REDIS_STRING, REDIS_HASH and REDIS_SET
- $key : string
-
the key for the resource
- $subKey : int|string = null
-
applicable to hashes
formatCheckoutRequestSubscriptionValues()
private
formatCheckoutRequestSubscriptionValues(CheckoutRequestVatReg|CheckoutRequestProforma $checkoutSubscriptionRequest) : mixed
Parameters
- $checkoutSubscriptionRequest : CheckoutRequestVatReg|CheckoutRequestProforma
getCustomerTaxRateByClientId()
private
getCustomerTaxRateByClientId(int $clientId) : mixed
Parameters
- $clientId : int
getObjectValues()
private
getObjectValues(mixed $resource) : mixed
Parameters
- $resource : mixed
getPlanTypeIdBySubscription()
private
getPlanTypeIdBySubscription(Subscription $subscription) : int|null
Parameters
- $subscription : Subscription
Return values
int|nullinitNewInstance()
private
initNewInstance(mixed $resource) : mixed
Parameters
- $resource : mixed
isValidCustomerData()
private
isValidCustomerData(Customer $customer) : mixed
Parameters
- $customer : Customer
isValidPlanData()
private
isValidPlanData(Plan $plan) : mixed
Parameters
- $plan : Plan
isValidSubscriptionData()
private
isValidSubscriptionData(Subscription $subscription) : mixed
Parameters
- $subscription : Subscription
rawResourceHasValidTimeStamp()
private
rawResourceHasValidTimeStamp(mixed $rawResource[, int|null $allowedLifetime = null ]) : mixed
Parameters
- $rawResource : mixed
- $allowedLifetime : int|null = null
removeRequestSubscriptionFromCache()
private
removeRequestSubscriptionFromCache(CheckoutRequestVatReg|CheckoutRequestProforma|CheckoutRequestOss $subscription) : mixed
Parameters
- $subscription : CheckoutRequestVatReg|CheckoutRequestProforma|CheckoutRequestOss
serializeResource()
private
serializeResource(mixed $resource) : mixed
Parameters
- $resource : mixed
syncPendingSubscriptionsFromDb()
private
syncPendingSubscriptionsFromDb() : mixed
updatePlanInDb()
private
updatePlanInDb(mixed $plan) : mixed
Parameters
- $plan : mixed
updateProformaSubscriptionInDb()
private
updateProformaSubscriptionInDb(Subscription $subscription) : mixed
Parameters
- $subscription : Subscription