Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
psr16-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyoung committed Dec 2, 2019
1 parent 2845352 commit b37d909
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Kernel/Concerns/InteractsWithCache.php
Expand Up @@ -12,6 +12,8 @@
namespace EasyDingTalk\Kernel\Concerns;

use Psr\SimpleCache\CacheInterface;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;
use Symfony\Component\Cache\Simple\FilesystemCache;

trait InteractsWithCache
Expand Down Expand Up @@ -42,6 +44,10 @@ public function getCache()
*/
protected function createDefaultCache()
{
if (class_exists(Psr16Cache::class)) {
return new Psr16Cache(new FilesystemAdapter('easydingtalk'));
}

return new FilesystemCache('easydingtalk');
}
}

0 comments on commit b37d909

Please sign in to comment.