File tree Expand file tree Collapse file tree 4 files changed +6
-3
lines changed Expand file tree Collapse file tree 4 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
// Setup File Path on your config files
24
24
CacheManager::setDefaultConfig ([
25
- "path " => ' /var/www/phpfastcache.dev.geolim4.com/geolim4/tmp ' , // or in windows "C:/tmp/"
25
+ "path " => sys_get_temp_dir (),
26
26
]);
27
27
28
28
// In your class, function, you can call the Cache
39
39
if (is_null ($ CachedString ->get ())) {
40
40
//$CachedString = "Files Cache --> Cache Enabled --> Well done !";
41
41
// 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 ! " );
43
43
$ InstanceCache ->save ($ CachedString );
44
44
45
45
echo "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // " ;
Original file line number Diff line number Diff line change 23
23
24
24
// Setup File Path on your config files
25
25
CacheManager::setDefaultConfig ([
26
- "path " => ' /var/www/phpfastcache.dev.geolim4.com/geolim4/tmp ' , // or in windows "C:/tmp/"
26
+ "path " => sys_get_temp_dir (),
27
27
]);
28
28
29
29
// In your class, function, you can call the Cache
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class CacheManager
52
52
*/
53
53
protected static $ config = [
54
54
'securityKey ' => 'auto ' ,// The securityKey that will be used to create sub-directory
55
+ 'defaultTtl ' => 900 ,// Default time-to-live in second
55
56
'htaccess ' => true ,// Auto-generate .htaccess if tit is missing
56
57
'default_chmod ' => 0777 , // 0777 recommended
57
58
'path ' => '' ,// if not set will be the value of sys_get_temp_dir()
Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ public function getItem($key)
68
68
} else {
69
69
$ item ->setHit (true );
70
70
}
71
+ } else {
72
+ $ item ->expiresAfter (abs ((int ) $ this ->getConfig ()[ 'defaultTtl ' ]));
71
73
}
72
74
73
75
}
You can’t perform that action at this time.
0 commit comments