-
Notifications
You must be signed in to change notification settings - Fork 12
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
Showing
14 changed files
with
625 additions
and
38 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,3 @@ | ||
*.js linguist-language=php | ||
*.css linguist-language=php | ||
*.html linguist-language=php |
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
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,52 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* | ||
* FastCache | ||
*/ | ||
namespace Hunter\Core\Cache; | ||
|
||
use Phpfastcache\CacheManager; | ||
use Phpfastcache\Config\Config; | ||
|
||
class FastCache { | ||
|
||
private static $instance = null; | ||
private $conn; | ||
|
||
private function __construct(){ | ||
$cache_dir = $GLOBALS['cache_dir']; | ||
$this->conn = CacheManager::getInstance('files', new Config(["path" => $cache_dir, "itemDetailedDate" => false])); | ||
} | ||
|
||
public static function getInstance(){ | ||
if(!self::$instance){ | ||
self::$instance = new FastCache(); | ||
} | ||
return self::$instance; | ||
} | ||
|
||
public function getConnection(){ | ||
return $this->conn; | ||
} | ||
|
||
public function isCached($key){ | ||
$CachedString = $this->conn->getItem($key); | ||
return $CachedString->isHit(); | ||
} | ||
|
||
public function set($key, $data, $expire = 60){ | ||
$CachedString = $this->conn->getItem($key); | ||
$CachedString->set($data)->expiresAfter($expire); | ||
$this->conn->save($CachedString); | ||
} | ||
|
||
public function get($key){ | ||
return $this->conn->getItem($key)->get(); | ||
} | ||
|
||
private function __clone(){ | ||
} | ||
|
||
} |
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.