forked from uup-dump/api
A little cleanup of the caching class
This commit is contained in:
parent
067f7f2937
commit
be2a2f2877
@ -17,15 +17,13 @@ limitations under the License.
|
|||||||
|
|
||||||
class UupDumpCache {
|
class UupDumpCache {
|
||||||
private $cacheFile;
|
private $cacheFile;
|
||||||
private $isCompressed;
|
|
||||||
private $newCacheVersion = 1;
|
private $newCacheVersion = 1;
|
||||||
|
|
||||||
public function __construct($resource, $compressed = true) {
|
public function __construct($resource, private $isCompressed = true) {
|
||||||
$res = $resource."+cache_v".$this->newCacheVersion;
|
$res = $resource."+cache_v".$this->newCacheVersion;
|
||||||
$cacheHash = hash('sha256', strtolower($res));
|
$cacheHash = hash('sha256', strtolower($res));
|
||||||
$ext = $compressed ? '.json.gz' : '.json';
|
$ext = $isCompressed ? '.json.gz' : '.json';
|
||||||
$this->cacheFile = 'cache/'.$cacheHash.$ext;
|
$this->cacheFile = 'cache/'.$cacheHash.$ext;
|
||||||
$this->isCompressed = $compressed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFileName() {
|
public function getFileName() {
|
||||||
|
Loading…
Reference in New Issue
Block a user