tokenly / credits-cache
A library to cache app credits locally. Requires Laravel.
Installs: 1 146
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/tokenly/credits-cache
Requires
- php: >=5.5.0
 
Requires (Dev)
- mockery/mockery: 1.1
 - phpunit/phpunit: ~7
 
This package is not auto-updated.
Last update: 2025-11-03 19:56:56 UTC
README
App Credits Cache
A library to cache Tokenpass app credits locally. Requires Laravel.
Installation
composer require tokenly/credits-cache- Add 
Tokenly\CreditsCache\CreditBalanceCacheProvider::classto your list of service providers 
Usage
Fetching a balance
$credits_cache = app(\Tokenly\CreditsCache\CreditBalanceCache::class); $credit_balance = $credits_cache->getCredits($credits_group_id, $user_account_uuid);
If no local cache balance is present, the cache will call the Tokenpass API and populate it.
Clearing the cache
To clear the local cache, fire a CreditBalanceChanged event.  This will force a reload from Tokenpass on the next getCredits call.
use Tokenly\CreditsCache\CreditBalanceChanged; event(new CreditBalanceChanged($credits_group_id, $user_account_uuid));