A library to cache app credits locally. Requires Laravel.

dev-master 2020-05-07 02:48 UTC

This package is not auto-updated.

Last update: 2020-09-13 18:40:04 UTC


Build Status

App Credits Cache

A library to cache Tokenpass app credits locally. Requires Laravel.


  • composer require tokenly/credits-cache
  • Add Tokenly\CreditsCache\CreditBalanceCacheProvider::class to your list of service providers


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));