Towns & NPCs & Items should be persistent

This commit is contained in:
slawkens 2023-11-11 12:04:21 +01:00
parent 130ad25c4d
commit 556ef47d59
7 changed files with 8 additions and 7 deletions

1
.gitignore vendored
View File

@ -47,6 +47,7 @@ system/cache/*
!system/cache/twig/index.html
!system/cache/signatures/index.html
!system/cache/plugins/index.html
!system/cache/persistent/index.html
# logs
system/logs/*

0
system/cache/persistent/index.html vendored Normal file
View File

View File

@ -1262,7 +1262,7 @@ function clearCache()
deleteDirectory(CACHE . 'signatures', ['index.html'], true);
deleteDirectory(CACHE . 'twig', ['index.html'], true);
deleteDirectory(CACHE . 'plugins', ['index.html'], true);
deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html'], true);
deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true);
// routes cache
$routeCacheFile = CACHE . 'route.cache';

View File

@ -38,7 +38,7 @@ class DataLoader
{
self::$startTime = microtime(true);
require LIBS . 'items.php';
require_once LIBS . 'items.php';
if(Items::loadFromXML()) {
success(self::$locale['step_database_loaded_items'] . self::getLoadedTime());
}

View File

@ -33,7 +33,7 @@ class Towns
/**
* @var string
*/
private static $filename = CACHE . 'towns.php';
private static $filename = CACHE . 'persistent' . 'towns.php';
/**
* Determine towns

View File

@ -40,7 +40,7 @@ class Items
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent');
$cache_php->set('items', $items, 5 * 365 * 24 * 60 * 60);
return true;
}
@ -68,7 +68,7 @@ class Items
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent');
self::$items = $cache_php->get('items');
}

View File

@ -41,7 +41,7 @@ class NPCs
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent');
$cache_php->set('npcs', $npcs, 5 * 365 * 24 * 60 * 60);
return true;
}
@ -53,7 +53,7 @@ class NPCs
}
require_once LIBS . 'cache_php.php';
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE);
$cache_php = new Cache_PHP(config('cache_prefix'), CACHE . 'persistent');
self::$npcs = $cache_php->get('npcs');
}
}