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 2222
2323// Setup File Path on your config files
2424CacheManager::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
3939if (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 // " ;
Original file line number Diff line number Diff line change 2323
2424// Setup File Path on your config files
2525CacheManager::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
Original file line number Diff line number Diff 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()
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments