first commit

This commit is contained in:
ExtraNetwork
2026-05-12 17:04:54 +03:00
commit e5c4b6aa13
1425 changed files with 284735 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Core\Repository\ApplicationCache;
use Carbon\Carbon;
use Illuminate\Contracts\Cache\Repository as Cache;
class ApplicationCacheRepository
{
private $cache;
private $carbon;
protected $cacheLife = 3600; // use second time ...
private $cachePrefix = "gExtranetApi-";
public function __construct(
Cache $cache,
Carbon $carbon
)
{
$this->cache = $cache;
$this->carbon = $carbon;
}
private function createCacheStoreKey ( $cacheId )
{
return $this->cachePrefix.$cacheId;
}
public function storeCache($cacheId , $param){
$result = $param;
$result["cacheId"] = $cacheId;
$cacheSignature = $this->createCacheStoreKey($cacheId);
$expiresAt = $this->carbon->addMinutes($this->cacheLife/60)->toDateTimeString();
$this->cache->put($cacheSignature, $result, $this->cacheLife);
return [
'cacheId' => $cacheId,
'expiresAt' => $expiresAt
];
}
public function getCache($cacheId){
$cacheId = $this->createCacheStoreKey($cacheId);
$cacheInfo = $this->cache->get($cacheId);
return $cacheInfo;
}
}