-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fba4f8
commit ea952a5
Showing
195 changed files
with
1,144 additions
and
1,815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace App\Helpers; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
|
||
class CacheControl | ||
{ | ||
/** | ||
* Cache Clear by key | ||
* | ||
* @param string $key | ||
* @return void | ||
*/ | ||
public static function clearCache(string $key) | ||
{ | ||
$keys = (array) Cache::get($key, []); | ||
|
||
foreach ($keys as $key) { | ||
Cache::forget($key); | ||
} | ||
|
||
Cache::forget($key); | ||
} | ||
|
||
/** | ||
* Put Cache key to another key as a array | ||
* | ||
* @param string $baseCacheKey | ||
* @param string $newCacheKey | ||
* @return void | ||
*/ | ||
public static function updateCacheKeys(string $baseCacheKey, string $newCacheKey) | ||
{ | ||
$cachedKeys = Cache::get($baseCacheKey, []); | ||
|
||
if (!in_array($newCacheKey, $cachedKeys)) { | ||
$cachedKeys[] = $newCacheKey; | ||
Cache::put($baseCacheKey, $cachedKeys); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.