for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace DucCnzj\Ip\Traits;
use DucCnzj\Ip\CacheStore;
use DucCnzj\Ip\Imp\CacheStoreImp;
trait CacheResponse
{
/**
* @var null|CacheStoreImp
*/
protected $cacheStore;
* @return CacheStore|CacheStoreImp
*
* @author duc <[email protected]>
public function getCacheStore()
if ($this->cacheStore instanceof CacheStoreImp) {
return $this->cacheStore;
}
return $this->cacheStore = $this->getDefaultCacheDriver();
* @return CacheStore
public function getDefaultCacheDriver()
return new CacheStore();
* @param CacheStoreImp $cacheStore
* @return $this
public function setCacheStore(CacheStoreImp $cacheStore)
$this->cacheStore = $cacheStore;
return $this;
public function cacheKey(string $name, string $ip)
return $name . ':' . $ip;