Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
*/
'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),

/**
* The prefix used to cache the results.
*
* E.g.: `[CACHE_PREFIX].75170fc230cd88f32e475ff4087f81d9`
*/
'cache_prefix' => 'igdb_cache',

/**
* Path where the webhooks should be handled.
*/
Expand Down
7 changes: 7 additions & 0 deletions docs/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ return [
* To turn cache off set this value to 0
*/
'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),

/**
* The prefix used to cache the results.
*
* E.g.: `[CACHE_PREFIX].75170fc230cd88f32e475ff4087f81d9`
*/
'cache_prefix' => 'igdb_cache',

/*
* Path where the webhooks should be handled.
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function count(string $endpoint, string $query, int $cacheLifetime

private static function handleCache(string $endpoint, string $query, int $cacheLifetime): string
{
$key = 'igdb_cache.' . md5($endpoint . $query);
$key = config('igdb.cache_prefix', 'igdb_cache') . '.' . md5($endpoint . $query);

if ($cacheLifetime === 0) {
Cache::forget($key);
Expand Down