-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use apcu instead of laravel cache (#32)
* Use apcu instead of laravel cache * Cs fix
- Loading branch information
1 parent
6211986
commit f6db0b0
Showing
3 changed files
with
36 additions
and
3 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
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,33 @@ | ||
<?php | ||
|
||
namespace Cego\FilebeatLogging; | ||
|
||
use DeviceDetector\Cache\CacheInterface; | ||
|
||
class ApcuCache implements CacheInterface | ||
{ | ||
public function fetch(string $id) | ||
{ | ||
return apcu_fetch($id); | ||
} | ||
|
||
public function contains(string $id): bool | ||
{ | ||
return apcu_exists($id); | ||
} | ||
|
||
public function save(string $id, $data, int $lifeTime = 0): bool | ||
{ | ||
return apcu_store($id, $data, $lifeTime); | ||
} | ||
|
||
public function delete(string $id): bool | ||
{ | ||
return apcu_delete($id); | ||
} | ||
|
||
public function flushAll(): bool | ||
{ | ||
return apcu_clear_cache(); | ||
} | ||
} |
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