mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
I think the default cache size should be 10GB intead of 1GB nowadays.
This commit is contained in:
parent
c63fe6f56d
commit
b4a09e4296
@ -73,7 +73,7 @@ BamCache() :
|
|||||||
"model-cache-textures, or it may be independent."));
|
"model-cache-textures, or it may be independent."));
|
||||||
|
|
||||||
ConfigVariableInt model_cache_max_kbytes
|
ConfigVariableInt model_cache_max_kbytes
|
||||||
("model-cache-max-kbytes", 1048576,
|
("model-cache-max-kbytes", 10485760,
|
||||||
PRC_DESC("This is the maximum size of the model cache, in kilobytes."));
|
PRC_DESC("This is the maximum size of the model cache, in kilobytes."));
|
||||||
|
|
||||||
_cache_models = model_cache_models;
|
_cache_models = model_cache_models;
|
||||||
@ -240,6 +240,8 @@ store(BamCacheRecord *record) {
|
|||||||
{
|
{
|
||||||
BamWriter writer(&dout);
|
BamWriter writer(&dout);
|
||||||
if (!writer.init()) {
|
if (!writer.init()) {
|
||||||
|
util_cat.error()
|
||||||
|
<< "Unable to write Bam header to " << temp_pathname << "\n";
|
||||||
vfs->delete_file(temp_pathname);
|
vfs->delete_file(temp_pathname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -255,11 +257,15 @@ store(BamCacheRecord *record) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!writer.write_object(record)) {
|
if (!writer.write_object(record)) {
|
||||||
|
util_cat.error()
|
||||||
|
<< "Unable to write object to " << temp_pathname << "\n";
|
||||||
vfs->delete_file(temp_pathname);
|
vfs->delete_file(temp_pathname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!writer.write_object(record->get_data())) {
|
if (!writer.write_object(record->get_data())) {
|
||||||
|
util_cat.error()
|
||||||
|
<< "Unable to write object data to " << temp_pathname << "\n";
|
||||||
vfs->delete_file(temp_pathname);
|
vfs->delete_file(temp_pathname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -581,6 +587,10 @@ rebuild_index() {
|
|||||||
PT(BamCacheRecord) record = do_read_record(pathname, false);
|
PT(BamCacheRecord) record = do_read_record(pathname, false);
|
||||||
if (record == (BamCacheRecord *)NULL) {
|
if (record == (BamCacheRecord *)NULL) {
|
||||||
// Well, it was invalid, so blow it away.
|
// Well, it was invalid, so blow it away.
|
||||||
|
if (util_cat.is_debug()) {
|
||||||
|
util_cat.debug()
|
||||||
|
<< "Deleting invalid " << pathname << "\n";
|
||||||
|
}
|
||||||
file->delete_file();
|
file->delete_file();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -653,6 +663,11 @@ check_cache_size() {
|
|||||||
}
|
}
|
||||||
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr();
|
||||||
Filename cache_pathname(_root, record->get_cache_filename());
|
Filename cache_pathname(_root, record->get_cache_filename());
|
||||||
|
if (util_cat.is_debug()) {
|
||||||
|
util_cat.debug()
|
||||||
|
<< "Deleting " << cache_pathname
|
||||||
|
<< " to keep cache size below " << _max_kbytes << "K\n";
|
||||||
|
}
|
||||||
vfs->delete_file(cache_pathname);
|
vfs->delete_file(cache_pathname);
|
||||||
}
|
}
|
||||||
mark_index_stale();
|
mark_index_stale();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user