Skip to content

Commit dadb0d5

Browse files
authored
Merge pull request #314 from Geolim4/final
Fixed #313
2 parents b647232 + d7229fe commit dadb0d5

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

examples/files.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
// Setup File Path on your config files
2424
CacheManager::setDefaultConfig([
25-
"path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/"
25+
"path" => sys_get_temp_dir(),
2626
]);
2727

2828
// In your class, function, you can call the Cache
@@ -39,7 +39,7 @@
3939
if (is_null($CachedString->get())) {
4040
//$CachedString = "Files Cache --> Cache Enabled --> Well done !";
4141
// Write products to Cache in 10 minutes with same keyword
42-
$CachedString->set("Files Cache --> Cache Enabled --> Well done !")->expiresAfter(5);
42+
$CachedString->set("Files Cache --> Cache Enabled --> Well done !");
4343
$InstanceCache->save($CachedString);
4444

4545
echo "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // ";

examples/sqlite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
// Setup File Path on your config files
2525
CacheManager::setDefaultConfig([
26-
"path" => '/var/www/phpfastcache.dev.geolim4.com/geolim4/tmp', // or in windows "C:/tmp/"
26+
"path" => sys_get_temp_dir(),
2727
]);
2828

2929
// In your class, function, you can call the Cache

src/phpFastCache/CacheManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class CacheManager
5252
*/
5353
protected static $config = [
5454
'securityKey' => 'auto',// The securityKey that will be used to create sub-directory
55+
'defaultTtl' => 900,// Default time-to-live in second
5556
'htaccess' => true,// Auto-generate .htaccess if tit is missing
5657
'default_chmod' => 0777, // 0777 recommended
5758
'path' => '',// if not set will be the value of sys_get_temp_dir()

src/phpFastCache/Core/StandardPsr6StructureTrait.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public function getItem($key)
6868
} else {
6969
$item->setHit(true);
7070
}
71+
} else {
72+
$item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ]));
7173
}
7274

7375
}

0 commit comments

Comments
 (0)