Skip to content

Commit fc41ca7

Browse files
committed
Add config to adjust the cache prefix
- Closes #104
1 parent 4d0406f commit fc41ca7

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

config/config.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
*/
2020
'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),
2121

22+
/**
23+
* The prefix used to cache the results.
24+
*
25+
* E.g.: `[CACHE_PREFIX].75170fc230cd88f32e475ff4087f81d9`
26+
*/
27+
'cache_prefix' => 'igdb_cache',
28+
2229
/**
2330
* Path where the webhooks should be handled.
2431
*/

docs/01-installation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ return [
4545
* To turn cache off set this value to 0
4646
*/
4747
'cache_lifetime' => env('IGDB_CACHE_LIFETIME', 3600),
48+
49+
/**
50+
* The prefix used to cache the results.
51+
*
52+
* E.g.: `[CACHE_PREFIX].75170fc230cd88f32e475ff4087f81d9`
53+
*/
54+
'cache_prefix' => 'igdb_cache',
4855

4956
/*
5057
* Path where the webhooks should be handled.

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function count(string $endpoint, string $query, int $cacheLifetime
3939

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

4444
if ($cacheLifetime === 0) {
4545
Cache::forget($key);

0 commit comments

Comments
 (0)